From ca045890e7162a423a937e848340c87535c0643f Mon Sep 17 00:00:00 2001 From: Mikhail Mitrofanov Date: Mon, 13 Jan 2025 14:27:44 +0300 Subject: [PATCH] unit test load --- mROA.Test/UnitTest1.cs | 79 +++++++++++++++++++ mROA.Test/mROA.Test.csproj | 27 +++++++ .../Release/net9.0/mROA.Test.AssemblyInfo.cs | 22 ++++++ ....GeneratedMSBuildEditorConfig.editorconfig | 15 ++++ .../net9.0/mROA.Test.GlobalUsings.g.cs | 9 +++ mROA.Test/obj/mROA.Test.csproj.nuget.g.props | 26 ++++++ .../obj/mROA.Test.csproj.nuget.g.targets | 8 ++ mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs | 22 ++++++ ....GeneratedMSBuildEditorConfig.editorconfig | 15 ++++ .../obj/Release/net9.0/mROA.GlobalUsings.g.cs | 8 ++ mROA/obj/mROA.csproj.nuget.g.props | 16 ++++ mROA/obj/mROA.csproj.nuget.g.targets | 2 + 12 files changed, 249 insertions(+) create mode 100644 mROA.Test/UnitTest1.cs create mode 100644 mROA.Test/mROA.Test.csproj create mode 100644 mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs create mode 100644 mROA.Test/obj/Release/net9.0/mROA.Test.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 mROA.Test/obj/Release/net9.0/mROA.Test.GlobalUsings.g.cs create mode 100644 mROA.Test/obj/mROA.Test.csproj.nuget.g.props create mode 100644 mROA.Test/obj/mROA.Test.csproj.nuget.g.targets create mode 100644 mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs create mode 100644 mROA/obj/Release/net9.0/mROA.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 mROA/obj/Release/net9.0/mROA.GlobalUsings.g.cs create mode 100644 mROA/obj/mROA.csproj.nuget.g.props create mode 100644 mROA/obj/mROA.csproj.nuget.g.targets diff --git a/mROA.Test/UnitTest1.cs b/mROA.Test/UnitTest1.cs new file mode 100644 index 0000000..439e156 --- /dev/null +++ b/mROA.Test/UnitTest1.cs @@ -0,0 +1,79 @@ +using System.Diagnostics; +using System.Reflection; +using mROA.Implementation; + +namespace mROA.Test; + +public class Tests +{ + private ProgramlyInteractionChanel _interactionModule; + private ISerialisationModule _serialisationModule; + private IExecuteModule _executeModule; + private IMethodRepository _methodRepository; + private IContextRepository _contextRepository; + + private ITestController _testController; + + [SetUp] + public void Setup() + { + _interactionModule = new ProgramlyInteractionChanel(); + _serialisationModule = new JsonSerialisationModule(_interactionModule); + var repo = new MethodRepository(); + repo.CollectForAssembly(Assembly.GetExecutingAssembly()); + _methodRepository = repo; + var repo2 = new ContextRepository(); + repo2.FillSingletons(Assembly.GetExecutingAssembly()); + _contextRepository = repo2; + + _executeModule = new PrepairedExecutionModule(_methodRepository, _serialisationModule, _contextRepository); + + } + + [Test] + public void CommandPipelineTest() + { + var sw = Stopwatch.StartNew(); + + _interactionModule.PassCommand(132, """ + { + "RequestTypeId": 0, + "CommandId": 2 + } + """); + Assert.Pass(sw.ElapsedMilliseconds.ToString()); + } + + [Test] + public void CommandPipelineTestAsync() + { + var sw = Stopwatch.StartNew(); + _interactionModule.PassCommand(132, """ + { + "RequestTypeId": 0, + "CommandId": 3 + } + """); + while (_interactionModule.OutputBuffer.Count != 2) ; + + Assert.Pass(sw.ElapsedMilliseconds.ToString()); + } + + [Test] + public void MethodRegistrationTest() + { + var repo = new MethodRepository(); + repo.CollectForAssembly(Assembly.GetExecutingAssembly()); + Assert.That(repo.GetMethods().ToList().Count == 4); + } + + [Test] + public void ContextSupplyTest() + { + var repo = new ContextRepository(); + repo.FillSingletons(Assembly.GetExecutingAssembly()); + var singleObject = repo.GetSingleObject(typeof(ITestController)) as ITestController; + singleObject.B(); + Assert.That(singleObject.B() == 6); + } +} \ No newline at end of file diff --git a/mROA.Test/mROA.Test.csproj b/mROA.Test/mROA.Test.csproj new file mode 100644 index 0000000..1b7197f --- /dev/null +++ b/mROA.Test/mROA.Test.csproj @@ -0,0 +1,27 @@ + + + + net9.0 + latest + enable + enable + false + + + + + + + + + + + + + + + + + + + diff --git a/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs b/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs new file mode 100644 index 0000000..1410f8c --- /dev/null +++ b/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+da60eb27f99600ee3a9ee8526d2b26260efd8225")] +[assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")] +[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/mROA.Test/obj/Release/net9.0/mROA.Test.GeneratedMSBuildEditorConfig.editorconfig b/mROA.Test/obj/Release/net9.0/mROA.Test.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..41d3a9e --- /dev/null +++ b/mROA.Test/obj/Release/net9.0/mROA.Test.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,15 @@ +is_global = true +build_property.TargetFramework = net9.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = mROA.Test +build_property.ProjectDir = C:\Users\Mimm\Projects\VisualStudioProjects\mROA\mROA.Test\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/mROA.Test/obj/Release/net9.0/mROA.Test.GlobalUsings.g.cs b/mROA.Test/obj/Release/net9.0/mROA.Test.GlobalUsings.g.cs new file mode 100644 index 0000000..d32bf35 --- /dev/null +++ b/mROA.Test/obj/Release/net9.0/mROA.Test.GlobalUsings.g.cs @@ -0,0 +1,9 @@ +// +global using global::NUnit.Framework; +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props new file mode 100644 index 0000000..9be5ec7 --- /dev/null +++ b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props @@ -0,0 +1,26 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + PackageReference + 6.10.1 + + + + + + + + + + + + + + C:\Users\Mimm\.nuget\packages\nunit.analyzers\4.3.0 + + \ No newline at end of file diff --git a/mROA.Test/obj/mROA.Test.csproj.nuget.g.targets b/mROA.Test/obj/mROA.Test.csproj.nuget.g.targets new file mode 100644 index 0000000..56b5729 --- /dev/null +++ b/mROA.Test/obj/mROA.Test.csproj.nuget.g.targets @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs b/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs new file mode 100644 index 0000000..2ed3e1a --- /dev/null +++ b/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("mROA")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+da60eb27f99600ee3a9ee8526d2b26260efd8225")] +[assembly: System.Reflection.AssemblyProductAttribute("mROA")] +[assembly: System.Reflection.AssemblyTitleAttribute("mROA")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/mROA/obj/Release/net9.0/mROA.GeneratedMSBuildEditorConfig.editorconfig b/mROA/obj/Release/net9.0/mROA.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..c1caa79 --- /dev/null +++ b/mROA/obj/Release/net9.0/mROA.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,15 @@ +is_global = true +build_property.TargetFramework = net9.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = mROA +build_property.ProjectDir = C:\Users\Mimm\Projects\VisualStudioProjects\mROA\mROA\ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/mROA/obj/Release/net9.0/mROA.GlobalUsings.g.cs b/mROA/obj/Release/net9.0/mROA.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/mROA/obj/Release/net9.0/mROA.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/mROA/obj/mROA.csproj.nuget.g.props b/mROA/obj/mROA.csproj.nuget.g.props new file mode 100644 index 0000000..566ee42 --- /dev/null +++ b/mROA/obj/mROA.csproj.nuget.g.props @@ -0,0 +1,16 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + PackageReference + 6.10.1 + + + + + + \ No newline at end of file diff --git a/mROA/obj/mROA.csproj.nuget.g.targets b/mROA/obj/mROA.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/mROA/obj/mROA.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file