public void Delete_WithAllowedCacheType_CallsCacheService() { // Arrange CacheController controller = InitializeCacheController(); // Act var response = controller.Delete(); // Assert Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode); _cacheServiceMock.Verify(mock => mock.ClearCache(), Times.Once()); }
public void Delete_DependenciesFail_ReturnsHttpStatusCode500() { // Arrange _cacheServiceMock.Setup(c => c.ClearCache()).Throws <Exception>(); CacheController controller = InitializeCacheController(); // Act var response = controller.Delete(); // Assert Assert.AreEqual(HttpStatusCode.InternalServerError, response.StatusCode); }
public void DeleteCacheException() { //Arrange var controller = new CacheController(new ToDoMockService()); controller.Request = new HttpRequestMessage { Method = HttpMethod.Delete }; //Actual var response = controller.Delete(); //Assert Assert.AreEqual(HttpStatusCode.InternalServerError, response.StatusCode); }
public void DeleteCache() { //Arrange var controller = new CacheController(new ToDoBL(new ToDoRepository(), new DataCache())); controller.Request = new HttpRequestMessage { Method = HttpMethod.Delete }; //Actual var response = controller.Delete(); //Assert Assert.IsTrue(response.IsSuccessStatusCode); Assert.AreEqual(HttpStatusCode.Accepted, response.StatusCode); }