mirror of
https://github.com/AlexMacocian/Sybil.git
synced 2026-07-15 15:19:59 +00:00
Add field initializers
This commit is contained in:
@@ -14,6 +14,8 @@ public class FieldBuilderTests
|
||||
private const string FieldType = "string";
|
||||
private const string PublicField = "public string someString;";
|
||||
private const string PublicSealedField = "public sealed string someString;";
|
||||
private const string PublicSealedWithInitializer = "public sealed string someString = someValue;";
|
||||
private const string Initializer = "someValue";
|
||||
|
||||
private readonly FieldBuilder builder;
|
||||
|
||||
@@ -105,4 +107,25 @@ public class FieldBuilderTests
|
||||
|
||||
result.Should().Be(PublicSealedField);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WithInitializer_NullInitializer_ThrowsArgumentNullException()
|
||||
{
|
||||
var action = () =>
|
||||
{
|
||||
this.builder.WithInitializer(null);
|
||||
};
|
||||
|
||||
action.Should().Throw<ArgumentNullException>();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WithInitializer_ReturnsExpectedString()
|
||||
{
|
||||
var result = this.builder.WithModifiers(PublicSealed)
|
||||
.WithInitializer(Initializer).Build().ToFullString();
|
||||
|
||||
|
||||
result.Should().Be(PublicSealedWithInitializer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user