diff --git a/Rest.Net.Tests/RestClientGeneratorTests.cs b/Rest.Net.Tests/RestClientGeneratorTests.cs new file mode 100644 index 0000000..ea3b722 --- /dev/null +++ b/Rest.Net.Tests/RestClientGeneratorTests.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; +using FluentAssertions; +using MontoyaTech.Rest.Net; +using System.Net; + +namespace Rest.Net.Tests +{ + public class RestClientGeneratorTests + { + [Fact] + public void RestClientGenerator_HttpStatusCode_Should_BeSystemType() + { + var generator = new RestClientGenerator(); + + generator.IsTypeDotNet(typeof(HttpStatusCode)).Should().BeTrue(); + } + } +} diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj index f4126c6..0d9e867 100644 --- a/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net.csproj @@ -17,7 +17,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.4.4 + 1.4.5 Logo_Symbol_Black_Outline.png diff --git a/Rest.Net/RestClientGenerator.cs b/Rest.Net/RestClientGenerator.cs index a3cb914..ef85e7a 100644 --- a/Rest.Net/RestClientGenerator.cs +++ b/Rest.Net/RestClientGenerator.cs @@ -27,12 +27,11 @@ namespace MontoyaTech.Rest.Net /// /// /// - protected virtual bool IsTypeDotNet(Type type) + protected internal virtual bool IsTypeDotNet(Type type) { - if (type.Assembly.GetName().Name == "System.Private.CoreLib") - return true; + var assemblyName = type.Assembly.GetName().Name; - return false; + return assemblyName == "System.Private.CoreLib" || assemblyName == "System.Net.Primitives"; } /// @@ -40,7 +39,7 @@ namespace MontoyaTech.Rest.Net /// /// /// - protected virtual List FindTypeDependencies(Type type) + protected internal virtual List FindTypeDependencies(Type type) { var dependencies = new HashSet(); @@ -116,7 +115,7 @@ namespace MontoyaTech.Rest.Net /// /// /// - protected virtual List FindRouteDependencies(Route route) + protected internal virtual List FindRouteDependencies(Route route) { var dependencies = new HashSet(); @@ -187,7 +186,7 @@ namespace MontoyaTech.Rest.Net /// /// /// - protected virtual List FindRoutesDependencies(List routes) + protected internal virtual List FindRoutesDependencies(List routes) { var dependencies = new HashSet(); @@ -209,7 +208,7 @@ namespace MontoyaTech.Rest.Net /// /// /// - protected virtual string GetTypeFullyResolvedName(Type type) + protected internal virtual string GetTypeFullyResolvedName(Type type) { if (this.IsTypeDotNet(type)) { @@ -319,7 +318,7 @@ namespace MontoyaTech.Rest.Net /// /// /// - protected virtual Dictionary> FindRouteGroups(List routes) + protected internal virtual Dictionary> FindRouteGroups(List routes) { var groups = new Dictionary>();