示例#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);
        }