public void With_GetOnlyProperty_ThrowsKeyNotFoundException() { // arrange var builder = new TestClassBuilder(); // act void SetReadOnlyProperty() => builder.With(tc => tc.ICannotBeWrittenTo, 1.0); // assert Assert.ThrowsException <KeyNotFoundException>((Action)SetReadOnlyProperty); }
public void With_Field_ThrowsKeyNotFoundException() { // arrange var builder = new TestClassBuilder(); // act void SetField() => builder.With(tc => tc.IAmMostDefinitelyNotAProperty, "test"); // assert Assert.ThrowsException <KeyNotFoundException>((Action)SetField); }
public void With_SetterProperty_IsExpected() { // arrange var builder = new TestClassBuilder(); const int expected = 2; // act var result = builder.With(tc => tc.IAmAProperty, expected).Create(); // assert Assert.AreEqual(expected, result.IAmAProperty); }