minor code cleanup
This commit is contained in:
@@ -32,7 +32,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void PublicProperty_IsImplemented()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PublicProperty));
|
||||
.GetProperty(nameof(IAccessorsTestsService.PublicProperty))!;
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -47,14 +47,14 @@ namespace InterfaceGenerator.Tests
|
||||
public void InitProperty_IsImplemented()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.InitOnlyProperty));
|
||||
.GetProperty(nameof(IAccessorsTestsService.InitOnlyProperty))!;
|
||||
|
||||
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));
|
||||
|
||||
string _ = _sut.InitOnlyProperty;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void PrivateSetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateSetter));
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateSetter))!;
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void PrivateGetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateGetter));
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithPrivateGetter))!;
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void ProtectedSetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedSetter));
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedSetter))!;
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void ProtectedGetter_IsOmitted()
|
||||
{
|
||||
var prop = typeof(IAccessorsTestsService)
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedGetter));
|
||||
.GetProperty(nameof(IAccessorsTestsService.PropertyWithProtectedGetter))!;
|
||||
|
||||
prop.Should().NotBeNull();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void VoidMethod_IsImplemented()
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethod));
|
||||
nameof(MethodsTestService.VoidMethod))!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -35,7 +35,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void VoidMethodWithKeywordParam_IsImplemented()
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithKeywordParam));
|
||||
nameof(MethodsTestService.VoidMethodWithKeywordParam))!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -54,7 +54,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithParams),
|
||||
new[] { typeof(string), typeof(string) });
|
||||
new[] { typeof(string), typeof(string) })!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -71,7 +71,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithOutParam),
|
||||
new[] { typeof(string).MakeByRefType() });
|
||||
new[] { typeof(string).MakeByRefType() })!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -89,7 +89,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithInParam),
|
||||
new[] { typeof(string).MakeByRefType() });
|
||||
new[] { typeof(string).MakeByRefType() })!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -108,7 +108,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.VoidMethodWithRefParam),
|
||||
new[] { typeof(string).MakeByRefType() });
|
||||
new[] { typeof(string).MakeByRefType() })!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -127,7 +127,7 @@ namespace InterfaceGenerator.Tests
|
||||
public void StringMethod_IsImplemented()
|
||||
{
|
||||
var method = typeof(IMethodsTestService).GetMethod(
|
||||
nameof(MethodsTestService.StringMethod));
|
||||
nameof(MethodsTestService.StringMethod))!;
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(string));
|
||||
@@ -143,7 +143,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService)
|
||||
.GetMethods()
|
||||
.FirstOrDefault(x => x.Name == nameof(MethodsTestService.GenericVoidMethod));
|
||||
.First(x => x.Name == nameof(MethodsTestService.GenericVoidMethod));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -161,7 +161,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService)
|
||||
.GetMethods()
|
||||
.FirstOrDefault(x => x.Name == nameof(MethodsTestService.GenericVoidMethodWithGenericParam));
|
||||
.First(x => x.Name == nameof(MethodsTestService.GenericVoidMethodWithGenericParam));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -181,7 +181,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService)
|
||||
.GetMethods()
|
||||
.FirstOrDefault(x => x.Name == nameof(MethodsTestService.GenericVoidMethodWithConstraints));
|
||||
.First(x => x.Name == nameof(MethodsTestService.GenericVoidMethodWithConstraints));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -206,7 +206,7 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService)
|
||||
.GetMethods()
|
||||
.FirstOrDefault(x => x.Name == nameof(MethodsTestService.VoidMethodWithOptionalParams));
|
||||
.First(x => x.Name == nameof(MethodsTestService.VoidMethodWithOptionalParams));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
@@ -231,9 +231,8 @@ namespace InterfaceGenerator.Tests
|
||||
{
|
||||
var method = typeof(IMethodsTestService)
|
||||
.GetMethods()
|
||||
.FirstOrDefault(x => x.Name == nameof(MethodsTestService.VoidMethodWithExpandingParam));
|
||||
.First(x => x.Name == nameof(MethodsTestService.VoidMethodWithExpandingParam));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
|
||||
@@ -17,13 +17,13 @@ namespace InterfaceGenerator.Tests
|
||||
public void RecordProperty_IsGenerated()
|
||||
{
|
||||
var prop = typeof(ITestRecord)
|
||||
.GetProperty(nameof(TestRecord.RecordProperty));
|
||||
.GetProperty(nameof(TestRecord.RecordProperty))!;
|
||||
|
||||
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,7 +35,7 @@ namespace InterfaceGenerator.Tests
|
||||
nameof(TestRecord.RecordMethod));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
method!.ReturnType.Should().Be(typeof(void));
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
parameters.Should().BeEmpty();
|
||||
@@ -50,7 +50,7 @@ namespace InterfaceGenerator.Tests
|
||||
nameof(TestRecord.Deconstruct));
|
||||
|
||||
method.Should().NotBeNull();
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
method!.ReturnType.Should().Be(typeof(void));
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
parameters.Length.Should().Be(1);
|
||||
|
||||
Reference in New Issue
Block a user