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) , "Шаблон доставки не найден!"); }
public SaveDeliveryIntervalContext(DeliveryIntervalTemplate deliveryIntervalTemplate) { DeliveryIntervalTemplate = deliveryIntervalTemplate; }
private void SetupMocks(DeliveryIntervalTemplate deliveryIntervalTemplate) { _queryBuilderMock.Setup(x => x.For <DeliveryIntervalTemplate>() .WithAsync(It.IsAny <DeliveryIntervalTemplateByIdCriterion>())) .ReturnsAsync(deliveryIntervalTemplate); }
public DeliveryIntervalTemplateViewModel(DeliveryIntervalTemplate selectedDeliveryIntervalTemplate , List <DeliveryIntervalTemplate> deliveryIntervalTemplates) { SelectedDeliveryIntervalTemplate = selectedDeliveryIntervalTemplate; DeliveryIntervalTemplates = deliveryIntervalTemplates; }