public void CursusGetTest() { using (var repo = new CursusRepositoryMock()) { var target = new CursusController(repo); Assert.AreEqual(0, repo.TimesCalled); target.Get(); Assert.AreEqual(1, repo.TimesCalled); } }
public void VindAlleCursussenFaalendFoutmeldingTypeCheck() { using (var repo = new CursusRepositoryMock()) { //Arrange var target = new CursusController(repo); //Act var result = target.Get(); //Assert Assert.AreEqual(1, repo.TimesFindAllCalled); Assert.IsInstanceOfType((result as BadRequestObjectResult).Value, typeof(Foutmelding)); } }
public void CursusSetTest() { //Assert using (var repo = new CursusRepositoryMock()) { Assert.AreEqual(0, repo.TimesFindAllCalled); var target = new CursusController(repo); //Act target.Get(); //Assert Assert.AreEqual(1, repo.TimesFindAllCalled); } }
public void CursusGetWithIdTest() { //Assert using (var repo = new CursusRepositoryMock()) { Assert.AreEqual(0, repo.TimesFindCalled); var target = new CursusController(repo); //Act var result = target.Get(2); //Assert Assert.AreEqual(1, repo.TimesFindCalled); Assert.AreEqual(2, repo.FindByIdLastCallContent); } }
public void VindAlleCursussenFaalendErrorMessage() { using (var repo = new CursusRepositoryMock()) { //Arrange var target = new CursusController(repo); //Act var result = target.Get(); //Assert var testResult = (result as BadRequestObjectResult).Value; Assert.AreEqual(1, repo.TimesFindAllCalled); Assert.AreEqual("Oops, something went wrong", (testResult as Foutmelding).ErrorMessage); } }