Rename interface generator
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Common;
|
||||
using Xunit;
|
||||
|
||||
namespace InterfaceGenerator.Tests;
|
||||
namespace Speckle.InterfaceGenerator.Tests;
|
||||
|
||||
public class AccessorsGenerationTests
|
||||
{
|
||||
@@ -32,7 +33,7 @@ public class AccessorsGenerationTests
|
||||
public void PublicProperty_IsImplemented()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PublicProperty))!;
|
||||
.GetProperty(nameof(IAccessorsTestsService.PublicProperty)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -47,14 +48,14 @@ public class AccessorsGenerationTests
|
||||
public void InitProperty_IsImplemented()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.InitOnlyProperty))!;
|
||||
.GetProperty(nameof(IAccessorsTestsService.InitOnlyProperty)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
prop.GetMethod.Should().NotBeNull();
|
||||
prop.SetMethod.Should().NotBeNull();
|
||||
|
||||
prop.SetMethod!.ReturnParameter!.GetRequiredCustomModifiers().Should().Contain(typeof(IsExternalInit));
|
||||
prop.SetMethod?.ReturnParameter?.GetRequiredCustomModifiers().Should().Contain(typeof(IsExternalInit));
|
||||
|
||||
var _ = _sut.InitOnlyProperty;
|
||||
}
|
||||
@@ -63,7 +64,7 @@ public class AccessorsGenerationTests
|
||||
public void PrivateSetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateSetter))!;
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateSetter)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -77,7 +78,7 @@ public class AccessorsGenerationTests
|
||||
public void PrivateGetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateGetter))!;
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateGetter)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -91,7 +92,7 @@ public class AccessorsGenerationTests
|
||||
public void ProtectedSetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedSetter))!;
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedSetter)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -105,7 +106,7 @@ public class AccessorsGenerationTests
|
||||
public void ProtectedGetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedGetter))!;
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedGetter)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Reflection;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace InterfaceGenerator.Tests;
|
||||
namespace Speckle.InterfaceGenerator.Tests;
|
||||
|
||||
public class GenericInterfaceTests
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace InterfaceGenerator.Tests;
|
||||
namespace Speckle.InterfaceGenerator.Tests;
|
||||
|
||||
public class MethodGenerationTests
|
||||
{
|
||||
@@ -20,7 +20,7 @@ public class MethodGenerationTests
|
||||
public void VoidMethod_IsImplemented()
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethod))!;
|
||||
nameof(MethodsTestService.VoidMethod)) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -35,7 +35,7 @@ public class MethodGenerationTests
|
||||
public void VoidMethodWithKeywordParam_IsImplemented()
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithKeywordParam))!;
|
||||
nameof(MethodsTestService.VoidMethodWithKeywordParam)) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -54,7 +54,7 @@ public class MethodGenerationTests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithParams),
|
||||
new[] { typeof(string), typeof(string) })!;
|
||||
[typeof(string), typeof(string)]) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -71,7 +71,7 @@ public class MethodGenerationTests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithOutParam),
|
||||
new[] { typeof(string).MakeByRefType() })!;
|
||||
[typeof(string).MakeByRefType()]) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -89,7 +89,7 @@ public class MethodGenerationTests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithInParam),
|
||||
new[] { typeof(string).MakeByRefType() })!;
|
||||
[typeof(string).MakeByRefType()]) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -108,7 +108,7 @@ public class MethodGenerationTests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithRefParam),
|
||||
new[] { typeof(string).MakeByRefType() })!;
|
||||
[typeof(string).MakeByRefType()]) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -127,7 +127,7 @@ public class MethodGenerationTests
|
||||
public void StringMethod_IsImplemented()
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.StringMethod))!;
|
||||
nameof(MethodsTestService.StringMethod)) ?? throw new InvalidOperationException();
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(string));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace InterfaceGenerator.Tests.Partial;
|
||||
namespace Speckle.InterfaceGenerator.Tests.Partial;
|
||||
|
||||
[GenerateAutoInterface]
|
||||
internal partial class PartialClass : IPartialClass
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace InterfaceGenerator.Tests.Partial;
|
||||
namespace Speckle.InterfaceGenerator.Tests.Partial;
|
||||
|
||||
internal partial class PartialClass
|
||||
{
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using InterfaceGenerator.Tests.Partial;
|
||||
using Speckle.InterfaceGenerator.Tests.Partial;
|
||||
using Xunit;
|
||||
|
||||
namespace InterfaceGenerator.Tests;
|
||||
namespace Speckle.InterfaceGenerator.Tests;
|
||||
|
||||
public class PartialClassTests
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace InterfaceGenerator.Tests;
|
||||
namespace Speckle.InterfaceGenerator.Tests;
|
||||
|
||||
public class RecordInterfaceGenerationTests
|
||||
{
|
||||
@@ -17,13 +18,13 @@ public class RecordInterfaceGenerationTests
|
||||
public void RecordProperty_IsGenerated()
|
||||
{
|
||||
var prop = typeof(ITestRecord)
|
||||
.GetProperty(nameof(TestRecord.RecordProperty))!;
|
||||
.GetProperty(nameof(TestRecord.RecordProperty)) ?? throw new InvalidOperationException();
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
prop.GetMethod.Should().NotBeNull();
|
||||
prop.SetMethod.Should().NotBeNull();
|
||||
prop.SetMethod!.ReturnParameter!.GetRequiredCustomModifiers().Should().Contain(typeof(IsExternalInit));
|
||||
prop.SetMethod?.ReturnParameter?.GetRequiredCustomModifiers().Should().Contain(typeof(IsExternalInit));
|
||||
|
||||
_sut.RecordProperty.Should().Be(420);
|
||||
}
|
||||
@@ -35,9 +36,9 @@ public class RecordInterfaceGenerationTests
|
||||
nameof(TestRecord.RecordMethod));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method!.ReturnType.Should().Be(typeof(void));
|
||||
method?.ReturnType.Should().Be(typeof(void));
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
var parameters = method?.GetParameters();
|
||||
parameters.Should().BeEmpty();
|
||||
|
||||
_sut.RecordMethod();
|
||||
@@ -50,9 +51,9 @@ public class RecordInterfaceGenerationTests
|
||||
nameof(TestRecord.Deconstruct));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method!.ReturnType.Should().Be(typeof(void));
|
||||
method?.ReturnType.Should().Be(typeof(void));
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
var parameters = method?.GetParameters() ?? throw new InvalidOperationException();
|
||||
parameters.Length.Should().Be(1);
|
||||
|
||||
var parameter = parameters[0];
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
using Speckle.InterfaceGenerator;
|
||||
|
||||
namespace InterfaceGenerator.Tests.SameName_1;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
using Speckle.InterfaceGenerator;
|
||||
|
||||
namespace InterfaceGenerator.Tests.SameName_2;
|
||||
|
||||
[GenerateAutoInterface]
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<RootNamespace>Speckle.InterfaceGenerator.Tests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -14,7 +14,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\InterfaceGenerator\InterfaceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
<ProjectReference Include="..\InterfaceGenerator\Speckle.InterfaceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -2,7 +2,7 @@
|
||||
using FluentAssertions;
|
||||
using Xunit;
|
||||
|
||||
namespace InterfaceGenerator.Tests;
|
||||
namespace Speckle.InterfaceGenerator.Tests;
|
||||
|
||||
public class VisibilityModifierTests
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user