переделывание тестов

This commit is contained in:
2025-02-05 10:58:50 +03:00
parent fd1eda2661
commit f51dd93c87
28 changed files with 407 additions and 325 deletions
@@ -116,7 +116,7 @@ namespace {Namespace}
foreach (var method in methodBody)
{
var index = methods.Count;
methods.Add((namespaceName + "." + className, method));
methods.Add((namespaceName + "." + originalName, method));
var sb = new StringBuilder();
//Creating signature
@@ -230,6 +230,14 @@ public class CoCodegenMethodRepository :IMethodRepository
{{
return _methods;
}}
public void Inject<T>(T dependency)
{{
}}
public void Bake()
{{
}}
}}
";
context.AddSource($"CoCodegenMethodRepository.g.cs", SourceText.From(coCodegenRepoCode, Encoding.UTF8));
@@ -237,10 +245,11 @@ public class CoCodegenMethodRepository :IMethodRepository
var fronendRepoCode = @$"// <auto-generated/>
using System.Collections.Frozen;
namespace mROA.Implementation;
namespace mROA.Codegen;
public class FrontendContextRepository(ISerialisationModule.IFrontendSerialisationModule serialisationModule) : IContextRepository
public class FrontendContextRepository : IContextRepository
{{
private ISerialisationModule.IFrontendSerialisationModule _serialisationModule;
private static readonly FrozenDictionary<Type, Type> _remoteTypes = new Dictionary<Type, Type> {{
{string.Join(", \r\n\t\t", frontendContextRepo)}}}.ToFrozenDictionary();
@@ -263,7 +272,7 @@ public class FrontendContextRepository(ISerialisationModule.IFrontendSerialisati
{{
if (_remoteTypes.TryGetValue(typeof(T), out var remoteType))
{{
var remote = (T)Activator.CreateInstance(remoteType, id, serialisationModule)!;
var remote = (T)Activator.CreateInstance(remoteType, id, _serialisationModule)!;
return remote;
}}
throw new NotSupportedException();
@@ -271,7 +280,7 @@ public class FrontendContextRepository(ISerialisationModule.IFrontendSerialisati
public object GetSingleObject(Type type)
{{
return Activator.CreateInstance(_remoteTypes[type], -1, serialisationModule)!;
return Activator.CreateInstance(_remoteTypes[type], -1, _serialisationModule)!;
}}
public int GetObjectIndex(object o)
@@ -282,6 +291,16 @@ public class FrontendContextRepository(ISerialisationModule.IFrontendSerialisati
}}
throw new NotSupportedException();
}}
public void Inject<T>(T dependency)
{{
if (dependency is ISerialisationModule.IFrontendSerialisationModule serialisationModule)
_serialisationModule = serialisationModule;
}}
public void Bake()
{{
}}
}}
";
context.AddSource("FrontendContextRepository.g.cs", SourceText.From(fronendRepoCode, Encoding.UTF8));
@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ad2ef8e4b754b4cb2c5d3dbaa5c24f15201dd0f9")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fd1eda26618b8cebe94eaa0e27ce5e97353d2d09")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Codegen")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -5,18 +5,18 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mikhail\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Mikhail\.nuget\packages\" />
<SourceRoot Include="C:\Users\Mimm\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.4\buildTransitive\Microsoft.CodeAnalysis.Analyzers.props" Condition="Exists('$(NuGetPackageRoot)microsoft.codeanalysis.analyzers\3.3.4\buildTransitive\Microsoft.CodeAnalysis.Analyzers.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Mikhail\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.4</PkgMicrosoft_CodeAnalysis_Analyzers>
<PkgMicrosoft_CodeAnalysis_Analyzers Condition=" '$(PkgMicrosoft_CodeAnalysis_Analyzers)' == '' ">C:\Users\Mimm\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.4</PkgMicrosoft_CodeAnalysis_Analyzers>
</PropertyGroup>
</Project>