public void Then_project_page_should_be_opened()
        {
            string expectedUrl = SeleniumConfiguration.ProjectUrl;
            string actualUrl   = _driver.WaitUntilPageIsChanged(_homeUrl);

            CustomAssertions.EqualNotStrict(expectedUrl, actualUrl);
        }
        public async Task Edit_Customer_Throw_Exception(CustomerDetailModel model)
        {
            IMapper mapper = TestUtilities.GetMapper(new CustomerProfile(), new SharedProfile());
            var     mock   = new Mock <ICustomerService>();

            mock.Setup(x => x.Update(It.IsAny <Customer>())).ThrowsAsync(new Exception("failed"));

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

            address.State   = "MO";
            address.ZipCode = "12345";
            model.Addresses.Clear();
            model.Addresses.Add(new CustomerAddressDetailModel()
            {
                Address = address, Type = AddressType.Billing
            });
            model.Addresses.Add(new CustomerAddressDetailModel()
            {
                Address = address, Type = AddressType.Shipping
            });
            model.Contact.Email       = "*****@*****.**";
            model.Contact.Fax         = "123-1234";
            model.Contact.PhoneNumber = "123-1234";
            model.Institutions.Clear();
            model.ItemConfigurations.Clear();
            model.Documents.Clear();
            CustomerManager   manager           = new CustomerManager(_logger, mapper, mock.Object, Mock.Of <IUserService>(), Mock.Of <IIsotopeOrderingAuthorizationService>(), _eventService, Mock.Of <INotificationService>());
            ApplicationResult applicationResult = await manager.Edit(model);

            CustomAssertions.AssertExcpetionErrorsExist(applicationResult);
        }
Exemple #3
0
 public void Ctor_ShouldThrowExceptionIfInsurancePolicyRepositoryIsNull()
 {
     CustomAssertions.AssertArgumentNullExceptionThrown(() =>
     {
         _service.WithInsurancePolicyRepository(null).Build();
     });
 }
        public void Then_group_filter_should_be_appended_to_url()
        {
            var expectedUrl = $"{_dashboardUrl}&filter-group={_groupFilter}";
            var actualUrl   = _driver.WaitUntilPageIsChanged(_dashboardUrl);

            CustomAssertions.EqualNotStrict(actualUrl, expectedUrl);
        }
 public void Ctor_ShouldThrowExceptionIfPasswordHasherIsNull()
 {
     CustomAssertions.AssertArgumentNullExceptionThrown(() =>
     {
         _userManager.WithPasswordHasher(null).Build();
     }, "passwordHasher");
 }
        public async void Edit_Order_Valid(OrderDetailModel order)
        {
            var mockItemService = new Mock <IItemService>();

            var mockCustomerService = new Mock <ICustomerService>();

            var mockOrderService = new Mock <IOrderService>();

            mockOrderService.Setup(x => x.Update(It.IsAny <Order>()))
            .ReturnsAsync(1);

            order.BillingAddress  = TestUtilities.GetValidAddress();
            order.ShippingAddress = TestUtilities.GetValidAddress();
            order.Cart.Clear();
            order.Cart.Add(TestUtilities.GetValidOrderItem());
            order.Status         = OrderStatus.Sent;
            order.BillingContact = TestUtilities.GetValidContact();

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

            ApplicationResult result = await manager.Edit(order);

            _output.WriteLine(result.Message);
            CustomAssertions.AssertValidationErrorsDoNotExist(result);
        }
        public void Then_should_be_shown_selected_status()
        {
            var statusElements = GetAllStatusElements();
            var selectedStatus = GetSelectedStatusElements().First();

            CustomAssertions.EqualNotStrict(selectedStatus.Text, statusElements[1].Text);
        }
        public void Then_name_should_be_the_same_as_on_home_page()
        {
            _driver.WaitUntilPageIsChanged(_homePageUrl);
            string nameOnPage = GetEndpointNameOnDetailsPage();

            CustomAssertions.EqualNotStrict(_endpointName, nameOnPage);
        }
        public void Then_tag_filter_should_be_appended_to_url()
        {
            string exptectedUrl = $"{_homeUrl}&filter-tags={string.Join(";", _selectedTags)};";
            string actualUrl    = _driver.WaitUntilPageIsChanged(_homeUrl);

            CustomAssertions.EqualNotStrict(exptectedUrl, actualUrl);
        }
Exemple #10
0
        public void Then_dashboard_page_should_be_opened()
        {
            string expectedUrl = $"{SeleniumConfiguration.BaseUrl}dashboard";
            string actualUrl   = _driver.WaitUntilPageIsChanged(expectedUrl);

            CustomAssertions.EqualNotStrict(actualUrl, expectedUrl);
        }
        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);
        }
Exemple #12
0
 public void AddInsurancePolicyApplication_ShouldThrowExceptionIfPolicyIsNull()
 {
     CustomAssertions.AssertArgumentNullExceptionThrown(() =>
     {
         _service.Build().AddInsurancePolicyApplication(null);
     }, "policy");
 }
        public void Then_swagger_page_should_be_opened()
        {
            string expectedUrl = $"{SeleniumConfiguration.BaseUrl}swagger/ui/index";
            string actualUrl   = _driver.WaitUntilPageIsChanged(_homeUrl);

            CustomAssertions.EqualNotStrict(actualUrl, expectedUrl);
        }
Exemple #14
0
 public void Ctor_ShouldThrowExceptionIfSignInManagerIsNull()
 {
     CustomAssertions.AssertArgumentNullExceptionThrown(() =>
     {
         _controller.WithSignInManager(null).Build();
     }, "signInManager");
 }
Exemple #15
0
 public void Ctor_ShouldThrowExceptionIfPolicyServiceIsNull()
 {
     CustomAssertions.AssertArgumentNullExceptionThrown(() =>
     {
         _controller.WithPolicyService(null).Build();
     }, "policyService");
 }
        public void Then_filter_should_be_displayed_in_page_url()
        {
            var expectedUrl = $"{_dashboardUrl}&filter-status=healthy;faulty";
            var actualUrl   = _driver.WaitUntilPageIsChanged(_dashboardUrl);

            CustomAssertions.EqualNotStrict(actualUrl, expectedUrl);
        }
        public void Then_status_filter_should_be_appended_to_url()
        {
            var selectedStatus = GetSelectedStatusElements().First();
            var expectedUrl    = $"{_homeUrl}&filter-status={selectedStatus.Text}";
            var actualUrl      = _driver.WaitUntilPageIsChanged(_homeUrl);

            CustomAssertions.EqualNotStrict(actualUrl, expectedUrl);
        }
        public void Then_page_should_contain_title()
        {
            string actualTitle = Wait.Until(
                Timeouts.Default,
                () => _driver.Title,
                t => !string.IsNullOrEmpty(t),
                "Page does not contain title!");

            CustomAssertions.EqualNotStrict(actualTitle, _title);
        }
        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 Update_Form_Status()
        {
            var mockFormService = new Mock <IFormService>();

            mockFormService.Setup(x => x.UpdateCustomerFormStatus(It.IsAny <int>(), It.IsAny <CustomerFormStatus>())).Returns(Task.CompletedTask);

            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>());

            ApplicationResult result = await manager.UpdateFormStatus(1, 1, CustomerFormStatus.Approved);

            CustomAssertions.AssertValidationErrorsDoNotExist(result);
        }
Exemple #21
0
        public async void Delete_Item()
        {
            var mockItemService = new Mock <IItemService>();

            mockItemService.Setup(x => x.Delete(It.IsAny <int>())).ReturnsAsync(1);

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

            ApplicationResult result = await manager.Delete(1);

            CustomAssertions.AssertValidationErrorsDoNotExist(result);
        }
        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));
        }
        public virtual bool CheckThat <U>(U actual, string summary, Matcher <U> matcher)
        {
            AssertionItem item = CustomAssertions.CheckThat(summary, actual, matcher);

            log.Info(summary + ": " + item.Result.passed().ToString());
            if (item.Result.passed())
            {
                return(true);
            }
            else
            {
                Assert.False(true, summary + " returned false");
                return(false);
            }
        }
Exemple #24
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);
        }
        public async void Submit_Valid_InitiationForm(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>()
            {
                new FormInitiationItemModel()
                {
                    IsSelected = true
                }
            };
            Fixture            fixture = new Fixture();
            AddressDetailModel address = fixture.Create <AddressDetailModel>();

            address.State   = "MO";
            address.ZipCode = "12345";

            ContactDetailModel contact = fixture.Create <ContactDetailModel>();

            contact.Email        = "*****@*****.**";
            contact.PhoneNumber  = "123-123-1234";
            form.InitiationModel = new FormInitiationDetailModel()
            {
                Institution = new InstitutionDetailModel()
                {
                    Name             = "Test",
                    Address          = address,
                    FinancialContact = contact,
                    SafetyContact    = contact
                },
                ShippingAddress = address,
                Items           = items
            };
            form.CustomerDetailFormId = 1;
            form.InitiationModel.CustomerAdminSignature.Email       = "*****@*****.**";
            form.InitiationModel.CustomerAdminSignature.PhoneNumber = "123-123-1234";
            ApplicationResult result = await manager.SubmitInitiationForm(form);

            _output.WriteLine(result.Message);
            CustomAssertions.AssertValidationErrorsDoNotExist(result);
        }
        public async Task Using_single_project_should_contain_project()
        {
            var formatter = new TraversalProjectOutputFormatter();

            var projectPath = "/home/dev/test/";
            var projects    = new[]
            {
                new ProjectInfo("TestProject", projectPath)
            };

            var output = await formatter.Format(projects);

            CustomAssertions.LineSequenceEquals(output,
                                                l => Assert.Contains("Microsoft.Build.Traversal/3.0.3", l),
                                                l => Assert.Contains("ItemGroup", l),
                                                l => Assert.Contains(projectPath, l),
                                                l => Assert.Contains("ItemGroup", l),
                                                l => Assert.Contains("Project", l)
                                                );
        }
        public async Task Using_multiple_projects_should_contain_them_all()
        {
            var formatter = new TraversalProjectOutputFormatter();

            var firstProjectPath  = "/home/dev/test/";
            var secondProjectPath = "/home/dev/other-test/";
            var projects          = new[]
            {
                new ProjectInfo("TestProject", firstProjectPath), new ProjectInfo("OtherTest", secondProjectPath)
            };

            var output = await formatter.Format(projects);

            CustomAssertions.LineSequenceEquals(output,
                                                l => Assert.Contains("Microsoft.Build.Traversal/3.0.3", l),
                                                l => Assert.Contains("ItemGroup", l),
                                                l => Assert.Contains(secondProjectPath, l),
                                                l => Assert.Contains(firstProjectPath, l),
                                                l => Assert.Contains("ItemGroup", l),
                                                l => Assert.Contains("Project", l)
                                                );
        }
Exemple #28
0
        public void Then_group_should_be_the_same_as_on_home_page()
        {
            string groupOnPage = GetEndpointGroupOnDetailsPage();

            CustomAssertions.EqualNotStrict(_endpointGroup, groupOnPage);
        }
Exemple #29
0
        public async Task ThenTheTableOnTheDatabaseShouldOnlyContainTheDataNoOrdering(string tableName, string databaseName, TypedTable expectedRows)
        {
            var actualRows = await Context.Database.ReadAllAsync(databaseName, tableName);

            CustomAssertions.ResultsAreEqual(expectedRows, actualRows, false);
        }
        public void Then_home_page_should_open()
        {
            string actualUrl = _driver.WaitUntilPageIsChanged(_dashboardUrl);

            CustomAssertions.EqualNotStrict(actualUrl, SeleniumConfiguration.BaseUrl);
        }