public void Handles_WillAttend_Null_Values() { // Arrange IRepository repo = new MockRepository(); IPresenter<GuestResponse> target = new RSVPPresenter { repository = repo }; // Act GuestResponse dataObject = new GuestResponse { Name = "TEST", WillAttend = null }; IResult result = target.GetResult(dataObject); }
public void Adds_Object_To_Repository() { // Arrange IRepository repo = new MockRepository(); IPresenter<GuestResponse> target = new RSVPPresenter { repository = repo }; GuestResponse dataObject = new GuestResponse { Name = "TEST", WillAttend = true }; // Act IResult result = target.GetResult(dataObject); // Assert Assert.AreEqual(repo.GetAllResponses().Count(), 3); Assert.AreEqual(repo.GetAllResponses().Last().Name, "TEST"); Assert.AreEqual(repo.GetAllResponses().Last().WillAttend, true); }
public void Handles_WillAttend_Null_Values() { // Arrange IRepository repo = new MockRepository(); IPresenter <GuestResponse> target = new RSVPPresenter { repository = repo }; // Act GuestResponse dataObject = new GuestResponse { Name = "TEST", WillAttend = null }; IResult result = target.GetResult(dataObject); }
public void Handles_WillAttend_Bool_Values() { // Arrange IRepository repo = new MockRepository(); IPresenter<GuestResponse> target = new RSVPPresenter { repository = repo }; bool?[] values = { true, false }; // Act & Assert foreach (bool? testValue in values) { GuestResponse dataObject = new GuestResponse { Name = "TEST", WillAttend = testValue }; IResult result = target.GetResult(dataObject); Assert.IsInstanceOfType(result, typeof(RedirectResult)); } }
public void Adds_Object_To_Repository() { // Arrange IRepository repo = new MockRepository(); IPresenter <GuestResponse> target = new RSVPPresenter { repository = repo }; GuestResponse dataObject = new GuestResponse { Name = "TEST", WillAttend = true }; // Act IResult result = target.GetResult(dataObject); // Assert Assert.AreEqual(repo.GetAllResponses().Count(), 3); Assert.AreEqual(repo.GetAllResponses().Last().Name, "TEST"); Assert.AreEqual(repo.GetAllResponses().Last().WillAttend, true); }
public void Handles_WillAttend_Bool_Values() { // Arrange IRepository repo = new MockRepository(); IPresenter <GuestResponse> target = new RSVPPresenter { repository = repo }; bool?[] values = { true, false }; // Act & Assert foreach (bool?testValue in values) { GuestResponse dataObject = new GuestResponse { Name = "TEST", WillAttend = testValue }; IResult result = target.GetResult(dataObject); Assert.IsInstanceOfType(result, typeof(RedirectResult)); } }