public async void Submit_New_Invalid_InitiationForm_MissingItems(FormDetailModel form)
        {
            var mockFormService = new Mock <IFormService>();

            mockFormService.Setup(x => x.SubmitCustomerForm(It.IsAny <CustomerForm>())).ReturnsAsync(1);

            IMapper     mapper  = TestUtilities.GetMapper(new CustomerProfile(), new FormProfile(), new InstitutionProfile());
            FormManager manager = new FormManager(_logger, mapper, mockFormService.Object, Mock.Of <IItemService>(), Mock.Of <IIsotopeOrderingAuthorizationService>(), Mock.Of <ICustomerService>(), _eventService, Mock.Of <INotificationManager>());

            List <FormInitiationItemModel> items = new List <FormInitiationItemModel>();

            AddressDetailModel address = new Fixture().Create <AddressDetailModel>();

            address.State        = "MO";
            address.ZipCode      = "12345";
            form.InitiationModel = new FormInitiationDetailModel()
            {
                Institution = new InstitutionDetailModel()
                {
                    Id = 1
                },
                ShippingAddress = address,
                Items           = items
            };

            ApplicationResult result = await manager.SubmitInitiationForm(form);

            _output.WriteLine(result.Message);
            CustomAssertions.AssertValidationErrorsExist(result);
        }
        public async void Edit_Customer_With_Validation_Errors(CustomerDetailModel model)
        {
            IMapper         mapper  = TestUtilities.GetMapper(new CustomerProfile());
            CustomerManager manager = new CustomerManager(_logger, mapper, Mock.Of <ICustomerService>(), Mock.Of <IUserService>(), Mock.Of <IIsotopeOrderingAuthorizationService>(), _eventService, Mock.Of <INotificationService>());

            model.Addresses.Clear();

            ApplicationResult applicationResult = await manager.Edit(model);

            _output.WriteLine(applicationResult.Message);
            CustomAssertions.AssertValidationErrorsExist(applicationResult);
        }
        public async void Create_Order_Invalid(OrderDetailModel order)
        {
            var mockItemService = new Mock <IItemService>();

            var mockCustomerService = new Mock <ICustomerService>();

            var mockOrderService = new Mock <IOrderService>();

            order.Cart.Clear();

            IMapper      mapper  = TestUtilities.GetMapper(new ItemProfile(), new OrderProfile());
            OrderManager manager = new OrderManager(_logger, mapper, mockOrderService.Object, mockItemService.Object, mockCustomerService.Object, Mock.Of <IShipmentService>(), _eventService, Mock.Of <IIsotopeOrderingAuthorizationService>());

            CustomAssertions.AssertValidationErrorsExist(await manager.Create(order));
        }
Exemple #4
0
        public async void Edit_Item_Invalid_MinGreaterThanMax(ItemDetailModel model)
        {
            var mockItemService = new Mock <IItemService>();

            mockItemService.Setup(x => x.Update(It.IsAny <Item>())).ReturnsAsync(1);

            IMapper     mapper  = TestUtilities.GetMapper(new ItemProfile());
            ItemManager manager = new ItemManager(_logger, mapper, mockItemService.Object);

            model.DefaultMinQuantity = 10;
            model.DefaultMaxQuantity = 5;

            ApplicationResult result = await manager.Edit(model);

            _output.WriteLine(result.Message);
            CustomAssertions.AssertValidationErrorsExist(result);
        }