示例#1
0
        public async Task <IActionResult> SaveDeliveryInterval(SaveDeliveryIntervalContext context)
        {
            var commandResult = await _commandBuilder.ExecuteAsync(context);

            if (commandResult.IsDone)
            {
                return(RedirectToAction("Index", "Subscription"));
            }

            return(RedirectToAction("Index", context.DeliveryIntervalTemplate.Id));
        }
        public void ShouldReturnException_WhenThereIsNoDeliveryIntervalTemplateWithPointedId()
        {
            var templatePointedId = -1;

            SetupMocks(null);
            var template = new DeliveryIntervalTemplate {
                Id = templatePointedId
            };

            var context = new SaveDeliveryIntervalContext(template);
            var command = new SaveDeliveryIntervalCommand(_queryBuilderMock.Object, _commandBuilderMock.Object);

            Assert.ThrowsAsync <Exception>(async() => await command.ExecuteAsync(context)
                                           , "Шаблон доставки не найден!");
        }