Example #1
0
        public async Task PostMethod_WithoutContent()
        {
            ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object);

            controller.Request = GetHttpRequest(false);
            var result = await controller.Post();

            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
            var value = (BadRequestErrorMessageResult)result;

            Assert.AreEqual(0, _processorMock.Count);
            Assert.AreEqual("Не передан файл для загрузки.", value.Message);
        }
Example #2
0
        public async Task PostMethod_WithContent()
        {
            ProcessorController controller = new ProcessorController(_uploadImageServiceMock.Object, _processorMock.Object);

            controller.Request = GetHttpRequest();
            var result = await controller.Post();

            Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult <string>));
            var value = (CreatedAtRouteNegotiatedContentResult <string>)result;

            Assert.AreEqual(1, _processorMock.Count);
            Assert.AreEqual("DefaultApi", value.RouteName);
            Assert.AreEqual(2, value.RouteValues.Count);
        }