public void Build_WithAuthorReducedVersion_CreatesCite() { // Arrange BookCiteBuilder builder = new BookCiteBuilder() .WithAuthorReducedVersion("Arthur", "Conan Doyle"); // Act BookCite actual = builder.Build(); // Assert Assert.NotNull(actual); new { Title = (string)null, Author = "Conan Doyle, A.", Publisher = (string)null, }.ToExpectedObject().ShouldMatch(actual); }
public void Build_UsingTwiceSetForSameParameter_CreatesCite() { // Arrange const string Title = "The Hound of the Baskervilles"; var builder = new BookCiteBuilder() .Set <BookCiteBuilder>(x => x.Title, () => "TEST") .Set <BookCiteBuilder>(x => x.Title, () => Title); // Act BookCite actual = builder.Build(); // Assert Assert.NotNull(actual); new { Title = Title, Author = (string)null, Publisher = (string)null, }.ToExpectedObject().ShouldMatch(actual); }
public void Build_UsingSetDirectly_CreatesCite() { // Arrange const string Title = "The Hound of the Baskervilles"; var builder = new BookCiteBuilder() .WithAuthorReducedVersion("Arthur", "Conan Doyle") .Set <BookCiteBuilder>(x => x.Title, () => Title); // Act BookCite actual = builder.Build(); // Assert Assert.NotNull(actual); new { Title = Title, Author = "Conan Doyle, A.", Publisher = (string)null, }.ToExpectedObject().ShouldMatch(actual); }