Skip to content

Commit

Permalink
Fixed .With() in test cases to be generic. (#5)
Browse files Browse the repository at this point in the history
Fixed test cases .With to be generic. Changed unit tests accordingly.
  • Loading branch information
aalmada authored and mikhailshilkov committed Mar 4, 2017
1 parent 41402d2 commit 7b9cffc
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AssemblyToProcess/ConstructorWithSingleArgument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public ConstructorWithSingleArgument(int value1)

public string Value2 { get; set; }

public ConstructorWithSingleArgument With(object value) => this;
public ConstructorWithSingleArgument With<T>(T value) => this;
}
}
2 changes: 1 addition & 1 deletion AssemblyToProcess/MultipleConstructors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public MultipleConstructors(int value1, string value2, long value3)
public string Value2 { get; set; }

public long Value3 { get; set; }

public MultipleConstructors With<T>(T value) => this;
}
}
2 changes: 1 addition & 1 deletion AssemblyToProcess/MultipleConstructorsOnlyOneIsPublic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public MultipleConstructorsOnlyOneIsPublic(int value1, string value2)

public string Value2 { get; }

public MultipleConstructorsOnlyOneIsPublic With(object value) => this;
public MultipleConstructorsOnlyOneIsPublic With<T>(T value) => this;
}
}
2 changes: 1 addition & 1 deletion AssemblyToProcess/NoConstructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ public class NoConstructor

public string Value2 { get; set; }

public NoConstructor With(object value) => this;
public NoConstructor With<T>(T value) => this;
}
}
2 changes: 1 addition & 1 deletion AssemblyToProcess/NoMatchingProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public NoMatchingProperty(int value1, string value2, long value3)

public string Value2 { get; set; }

public NoMatchingProperty With(object value) => this;
public NoMatchingProperty With<T>(T value) => this;
}
}
2 changes: 1 addition & 1 deletion AssemblyToProcess/PropertyCasing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public PropertyCasing(int value1, string value2)

public string vaLue2 { get; }

public PropertyCasing With(object value) => this;
public PropertyCasing With<T>(T value) => this;
}
}
2 changes: 1 addition & 1 deletion Tests/WeaverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void Setup()
public void DoesNotSatisfyAllRules_NoWithIsInjected(string typeName)
{
var type = assembly.GetType($"AssemblyToProcess.{typeName}");
Assert.False(type.GetMethods().Any(m => m.Name.StartsWith("With") && m.GetParameters()[0].ParameterType != typeof(object)));
Assert.False(type.GetMethods().Any(m => m.Name.StartsWith("With") && !(m.IsGenericMethod && m.GetParameters().Length == 1)));
}

[TestCase("MultipleConstructors")]
Expand Down

0 comments on commit 7b9cffc

Please sign in to comment.