public void BuilderBaseTests_BuildWithPropertiesAction() { var book = MockBook.CreateBuilder().SetTitle("Hello World").Build(); Assert.NotNull(book); Assert.Equal("Hello World", book.Title); }
public void BuilderBaseTests_BuildConstructorEntity_ValidateBaseObject() { var ex = Assert.Throws <ArgumentException>(() => MockBook.CreateBuilder(new MockBook { ISBN = "111" })); Assert.Equal("Bad ISBN", ex.Message); }
public void BuilderBaseTests_BuildEmpty_DifferentObjects() { var builder = MockBook.CreateBuilder(); var newBook1 = builder.Build(); var newBook2 = builder.Build(); Assert.NotNull(newBook1); Assert.NotNull(newBook2); Assert.Null(newBook1.Title); Assert.Null(newBook2.Title); Assert.NotEqual(newBook1, newBook2); }
public void BuilderBaseTests_BuildConstructorEntity_DifferentObjects() { var builder = MockBook.CreateBuilder(new MockBook { ISBN = "112" }); var newBook1 = builder.Build(); var newBook2 = builder.Build(); Assert.NotNull(newBook1); Assert.NotNull(newBook2); Assert.NotEqual(newBook1, newBook2); Assert.Equal(newBook1.ISBN, newBook2.ISBN); }
public void BuilderBaseTests_BuildWithNullEntity() { var ex = Assert.Throws <ArgumentNullException>(() => MockBook.CreateBuilder(null)); Assert.Equal("Value cannot be null.\r\nParameter name: baseEntity", ex.Message); }