public void DeleteNotFoundQuota() { //Arrange int userId = 1; string login = "******"; var mock = new Mock <IDataBaseManager>(); mock.Setup(o => o.GetAllQuotas(userId)).Returns(GetViewQuotas(userId)); mock.Setup(o => o.GetAllCities()).Returns(GetTestCities()); mock.Setup(o => o.GetUser(login)).Returns(GetTestUser(login)); var controller = new RefinanceApiController(mock.Object); //Act var result = controller.Delete(100); //Assert Assert.IsType <NotFoundResult>(result); }
public void DeleteQuota() { //Arrange int userId = 1; int qId = 2; string login = "******"; var mock = new Mock <IDataBaseManager>(); mock.Setup(o => o.GetAllQuotas(userId)).Returns(GetViewQuotas(userId)); mock.Setup(o => o.GetAllCities()).Returns(GetTestCities()); mock.Setup(o => o.GetUser(login)).Returns(GetTestUser(login)); mock.Setup(o => o.GetQuota(qId)).Returns(GetTestQuota(qId)); var controller = new RefinanceApiController(mock.Object); //Act var result = controller.Delete(qId); //Assert mock.Verify(r => r.DeleteQuota(qId)); Assert.IsType <OkObjectResult>(result); }