Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
feast107 committed Dec 19, 2023
1 parent 3ca235c commit 269c220
Show file tree
Hide file tree
Showing 13 changed files with 348 additions and 310 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "extern/CodeAnalysis"]
path = extern/CodeAnalysis
url = https://github.com/feast107/CodeAnalysis.git
[submodule "extern/IL"]
path = extern/IL
url = https://github.com/Antelcat/IL.git
1 change: 1 addition & 0 deletions extern/IL
Submodule IL added at e8bc8b
14 changes: 11 additions & 3 deletions src/Antelcat.ClaimSerialization.Tests.Runtime/IdentityModel.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
using System.Security.Claims;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using Antelcat.ClaimSerialization.ComponentModel;
using Antelcat.ClaimSerialization.Metadata;

namespace Antelcat.ClaimSerialization.Tests.Runtime;

public class IdentityModel
{
public string? Name { get; set; } = nameof(Name);

public string? Name { get; set; } = nameof(Name);

public int Id { get; set; } = 123456;
public int Id { get; set; } = 123456;

[ClaimType(ClaimTypes.Role)]
public ISet<Role> Roles { get; set; }
Expand All @@ -24,4 +26,10 @@ public enum Role
User,
Guest
}
}

[JsonSerializable(typeof(IdentityModel))]
public partial class JsonContext : JsonSerializerContext
{

}
29 changes: 20 additions & 9 deletions src/Antelcat.ClaimSerialization.Tests.Runtime/RuntimeTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Text.Json;

namespace Antelcat.ClaimSerialization.Tests.Runtime;

Expand All @@ -22,13 +22,7 @@ public void TestRuntime()
[Test]
public void TestTypes()
{
var list = new List<IdentityModel.Role>() { IdentityModel.Role.Admin };
var args = list.Cast<object>();
var method = typeof(Enumerable)
.GetMethods(BindingFlags.Public | BindingFlags.Static)
.First(x =>
x.Name == nameof(Enumerable.Select)
&& x.GetParameters()[1].ParameterType.GetGenericTypeDefinition() == typeof(Func<,>));
JsonSerializer.Serialize(new object(),typeof(Type));
}

private static bool Predicate(Type type)
Expand Down Expand Up @@ -63,4 +57,21 @@ private static IEnumerable<Type> EnumAllInterfaces(Type type)
yield return @interface;
}
}
}

[Test]
[Req(Arg = "")]
public void TestRef()
{
var a = (object)1;

Func<object?, object?> c = o => o;
Console.WriteLine(a);
}

}

public class ReqAttribute : Attribute
{
public required string Arg { get; set; }
}
delegate void Setter<T>(ref T target, T value);
7 changes: 7 additions & 0 deletions src/Antelcat.ClaimSerialization.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Feast.CodeAnalysis.LiteralG
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antelcat.ClaimSerialization.Tests.Runtime", "Antelcat.ClaimSerialization.Tests.Runtime\Antelcat.ClaimSerialization.Tests.Runtime.csproj", "{09C48496-D93E-4C1F-BE59-FAA226206B19}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Antelcat.IL", "..\extern\IL\src\Antelcat.IL\Antelcat.IL.csproj", "{1F3D864A-F3E5-48D9-85E0-FF1D6E9E77D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -61,13 +63,18 @@ Global
{09C48496-D93E-4C1F-BE59-FAA226206B19}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09C48496-D93E-4C1F-BE59-FAA226206B19}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09C48496-D93E-4C1F-BE59-FAA226206B19}.Release|Any CPU.Build.0 = Release|Any CPU
{1F3D864A-F3E5-48D9-85E0-FF1D6E9E77D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F3D864A-F3E5-48D9-85E0-FF1D6E9E77D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F3D864A-F3E5-48D9-85E0-FF1D6E9E77D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F3D864A-F3E5-48D9-85E0-FF1D6E9E77D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7184E740-24E8-4DB5-8484-A81B55DF4BB7} = {30C60FDF-F02F-45CF-88B0-1CDDF8596483}
{A81EC26E-7A38-42B4-96CD-1B005BB40AB5} = {30C60FDF-F02F-45CF-88B0-1CDDF8596483}
{1F3D864A-F3E5-48D9-85E0-FF1D6E9E77D9} = {30C60FDF-F02F-45CF-88B0-1CDDF8596483}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB0E866D-B450-4CBD-BEF0-224F0B1856B8}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Antelcat.IL" Version="1.0.0" />
<ProjectReference Include="..\..\extern\IL\src\Antelcat.IL\Antelcat.IL.csproj" />
</ItemGroup>


<Import Project="..\Antelcat.ClaimSerialization.Shared\Antelcat.ClaimSerialization.Shared.projitems" Label="Shared" />

</Project>
7 changes: 4 additions & 3 deletions src/Antelcat.ClaimSerialization/ClaimSerializerContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Antelcat.ClaimSerialization;

namespace Antelcat.ClaimSerialization;

public abstract class ClaimSerializerContext
{
}
}

Loading

0 comments on commit 269c220

Please sign in to comment.