예제 #1
0
        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());
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }