diff --git a/OpenAIGenerator.sln b/OpenAIGenerator.sln index a954b55..7f5fbaa 100755 --- a/OpenAIGenerator.sln +++ b/OpenAIGenerator.sln @@ -22,6 +22,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAIGenerator.SnapshotTests", "src\tests\OpenAIGenerator.SnapshotTests\OpenAIGenerator.SnapshotTests.csproj", "{A70EF69D-A519-4571-81BC-E066A1DAED27}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAIGenerator.IntegrationTests", "src\tests\OpenAIGenerator.IntegrationTests\OpenAIGenerator.IntegrationTests.csproj", "{A23C604E-04A3-41F8-BF25-FD6ED6E8AA51}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -36,6 +38,10 @@ Global {A70EF69D-A519-4571-81BC-E066A1DAED27}.Debug|Any CPU.Build.0 = Debug|Any CPU {A70EF69D-A519-4571-81BC-E066A1DAED27}.Release|Any CPU.ActiveCfg = Release|Any CPU {A70EF69D-A519-4571-81BC-E066A1DAED27}.Release|Any CPU.Build.0 = Release|Any CPU + {A23C604E-04A3-41F8-BF25-FD6ED6E8AA51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A23C604E-04A3-41F8-BF25-FD6ED6E8AA51}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A23C604E-04A3-41F8-BF25-FD6ED6E8AA51}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A23C604E-04A3-41F8-BF25-FD6ED6E8AA51}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -43,6 +49,7 @@ Global GlobalSection(NestedProjects) = preSolution {8C39C5CD-A8D1-4528-9FCE-0190BD515466} = {6E5BF389-3D3F-4D74-9DD0-3B199CB529C5} {A70EF69D-A519-4571-81BC-E066A1DAED27} = {9CAA231D-7BE1-46C9-ACD6-EB2E569CEBEA} + {A23C604E-04A3-41F8-BF25-FD6ED6E8AA51} = {9CAA231D-7BE1-46C9-ACD6-EB2E569CEBEA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1493AEE4-9211-46E9-BFE6-8F629EAC5693} diff --git a/src/libs/OpenAIGenerator/OpenAIGenerator.csproj b/src/libs/OpenAIGenerator/OpenAIGenerator.csproj index f807b30..e0abe7e 100644 --- a/src/libs/OpenAIGenerator/OpenAIGenerator.csproj +++ b/src/libs/OpenAIGenerator/OpenAIGenerator.csproj @@ -28,5 +28,109 @@ runtime; build; native; contentfiles; analyzers; buildtransitive + + + $(GetTargetPathDependsOn);AddGenerationTimeReferences + + + + + + <_SystemLibs Include="Microsoft.CodeAnalysis" /> + <_SystemLibs Include="Microsoft.CodeAnalysis.CSharp" /> + <_SystemLibs Include="Microsoft.CodeAnalysis.CSharp.Workspaces" /> + <_SystemLibs Include="Microsoft.CodeAnalysis.Workspaces" /> + <_SystemLibs Include="System.Buffers" /> + <_SystemLibs Include="System.Collections.Immutable" /> + <_SystemLibs Include="System.Composition.AttributedModel" /> + <_SystemLibs Include="System.Composition.Convention" /> + <_SystemLibs Include="System.Composition.Hosting" /> + <_SystemLibs Include="System.Composition.Runtime" /> + <_SystemLibs Include="System.Composition.TypedParts" /> + <_SystemLibs Include="System.IO.Pipelines" /> + <_SystemLibs Include="System.Memory" /> + <_SystemLibs Include="System.Numerics.Vectors" /> + <_SystemLibs Include="System.Reflection.Metadata" /> + <_SystemLibs Include="System.Runtime.CompilerServices.Unsafe" /> + <_SystemLibs Include="System.Text.Encoding.CodePages" /> + <_SystemLibs Include="System.Threading.Tasks.Extensions" /> + + <_SystemLibs Include="Microsoft.NETCore.Platforms" /> + <_SystemLibs Include="Microsoft.Win32.Primitives" /> + <_SystemLibs Include="System.AppContext" /> + <_SystemLibs Include="System.Collections" /> + <_SystemLibs Include="System.Collections.Concurrent" /> + <_SystemLibs Include="System.Console" /> + <_SystemLibs Include="System.Diagnostics.Debug" /> + <_SystemLibs Include="System.Diagnostics.Tools" /> + <_SystemLibs Include="System.Diagnostics.Tracing" /> + <_SystemLibs Include="System.Globalization" /> + <_SystemLibs Include="System.Globalization.Calendars" /> + <_SystemLibs Include="System.IO" /> + <_SystemLibs Include="System.IO.Compression" /> + <_SystemLibs Include="System.IO.Compression.ZipFile" /> + <_SystemLibs Include="System.IO.FileSystem" /> + <_SystemLibs Include="System.IO.FileSystem.Primitives" /> + <_SystemLibs Include="System.Linq" /> + <_SystemLibs Include="System.Linq.Expressions" /> + <_SystemLibs Include="System.Net.Http" /> + <_SystemLibs Include="System.Net.Primitives" /> + <_SystemLibs Include="System.Net.Sockets" /> + <_SystemLibs Include="System.ObjectModel" /> + <_SystemLibs Include="System.Reflection" /> + <_SystemLibs Include="System.Reflection.Extensions" /> + <_SystemLibs Include="System.Reflection.Primitives" /> + <_SystemLibs Include="System.Resources.ResourceManager" /> + <_SystemLibs Include="System.Runtime" /> + <_SystemLibs Include="System.Runtime.Extensions" /> + <_SystemLibs Include="System.Runtime.Handles" /> + <_SystemLibs Include="System.Runtime.InteropServices" /> + <_SystemLibs Include="System.Runtime.InteropServices.RuntimeInformation" /> + <_SystemLibs Include="System.Runtime.Numerics" /> + <_SystemLibs Include="System.Security.Cryptography.Algorithms" /> + <_SystemLibs Include="System.Security.Cryptography.Encoding" /> + <_SystemLibs Include="System.Security.Cryptography.Primitives" /> + <_SystemLibs Include="System.Security.Cryptography.X509Certificates" /> + <_SystemLibs Include="System.Text.Encoding" /> + <_SystemLibs Include="System.Text.Encoding.Extensions" /> + <_SystemLibs Include="System.Text.RegularExpressions" /> + <_SystemLibs Include="System.Threading" /> + <_SystemLibs Include="System.Threading.Tasks" /> + <_SystemLibs Include="System.Threading.Timer" /> + <_SystemLibs Include="System.Xml.ReaderWriter" /> + <_SystemLibs Include="System.Xml.XDocument" /> + + + <_SystemLibs Include="System.Dynamic.Runtime" /> + + + <_SystemLibs Include="Microsoft.CSharp" /> + <_SystemLibs Include="System.Runtime.Serialization.Primitives" /> + + + <_SystemLibs Include="System.ComponentModel" /> + <_SystemLibs Include="System.Runtime.Serialization.Formatters" /> + + + + <_SystemLibsProperty>@(_SystemLibs) + <_ResolvedCompileFileDefinitions>@(ResolvedCompileFileDefinitions) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/tests/OpenAIGenerator.IntegrationTests/OpenAIGenerator.IntegrationTests.csproj b/src/tests/OpenAIGenerator.IntegrationTests/OpenAIGenerator.IntegrationTests.csproj new file mode 100755 index 0000000..2eaa39d --- /dev/null +++ b/src/tests/OpenAIGenerator.IntegrationTests/OpenAIGenerator.IntegrationTests.csproj @@ -0,0 +1,27 @@ + + + + net7.0 + $(OPENAI_API_KEY) + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/OpenAIGenerator.IntegrationTests/Prompts/calculator.prompt b/src/tests/OpenAIGenerator.IntegrationTests/Prompts/calculator.prompt new file mode 100755 index 0000000..edc1ed6 --- /dev/null +++ b/src/tests/OpenAIGenerator.IntegrationTests/Prompts/calculator.prompt @@ -0,0 +1,4 @@ +Write simple calculator class in C#. It should have 2 methods: Add and Multiply. +Both methods should take 2 arguments and return result. +You can use only + and * operators. +You can't use any other methods or classes. \ No newline at end of file diff --git a/src/tests/OpenAIGenerator.IntegrationTests/Tests.cs b/src/tests/OpenAIGenerator.IntegrationTests/Tests.cs new file mode 100755 index 0000000..a8d3250 --- /dev/null +++ b/src/tests/OpenAIGenerator.IntegrationTests/Tests.cs @@ -0,0 +1,14 @@ +namespace H.Ipc.Generator.IntegrationTests; + +[TestClass] +public class NSwagGeneratorTests +{ + [TestMethod] + public void GeneratesClientCorrectly() + { + var calculator = new Calculator(); + + calculator.Add(1, 1).Should().Be(2); + calculator.Multiply(1, 1).Should().Be(1); + } +} \ No newline at end of file