Beispiel #1
0
        public void generate_statement_number()
        {
            // Setup
            new Mock().PromiseFileReader();
            new Mock().PromiseEmailClient();

            Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1);

            EnterCustomer.ViewModel enterCustomerViewModel = null;

            Subscribe(Messages.REQUEST_VIEW_CUSTOMER_INFORMATION, obj =>
            {
                enterCustomerViewModel = CreateViewModel();
                AssignValues(enterCustomerViewModel);
                enterCustomerViewModel.SelectedServices = new List <Service>(obj as IEnumerable <Service>);
                enterCustomerViewModel.Load.Execute(null);
                enterCustomerViewModel.Generate.Execute(null);
            });

            var selectServicesViewModel = new CreateQuote.SelectServices.ViewModel();

            selectServicesViewModel.SelectedServices.Add(Mocks.SERVICE_1);
            selectServicesViewModel.Next.Execute(null);

            var calculateTransactionViewModel = new CalculateTransaction.ViewModel();

            calculateTransactionViewModel.Services.Add(Mocks.SERVICE_1);

            calculateTransactionViewModel.AddService.Execute(Mocks.SERVICE_1);
            enterCustomerViewModel.Generate.Execute(null);

            // Test
            var viewQuoteViewModel_1 = new ViewQuote.ViewModel();

            viewQuoteViewModel_1.Send.Execute(null);
            viewQuoteViewModel_1.Home.Execute(null);

            var viewQuoteViewModel_2 = new ViewQuote.ViewModel();

            viewQuoteViewModel_2.Send.Execute(null);
            viewQuoteViewModel_2.Home.Execute(null);

            // Verify
            var expected = viewQuoteViewModel_1.Quote.StatementNumber == 1 &&
                           viewQuoteViewModel_2.Quote.StatementNumber == 2;

            Assert.IsTrue(expected);
        }
Beispiel #2
0
        public void email_quote()
        {
            // Setup
            new Bootstrap().Run();

            var viewModel = new ViewQuote.ViewModel();

            new Mock().PromiseEmailClient();
            MockQuoteDependencies();

            // Test
            viewModel.Send.Execute(null);

            // Verify
            Assert.IsTrue(viewModel.IsSent);
        }
Beispiel #3
0
        public void email_quote()
        {
            // Setup
            new Bootstrap().Run();

            var viewModel = new ViewQuote.ViewModel();

            new Mock().PromiseEmailClient();
            MockQuoteDependencies();

            // Test
            viewModel.Send.Execute(null);

            // Verify
            Assert.IsTrue(viewModel.IsSent);
        }
Beispiel #4
0
        public void button_state_updates_after_sending_quote()
        {
            // Setup
            new Bootstrap().Run();

            var viewModel = new ViewQuote.ViewModel();

            new Mock().PromiseEmailClient();
            MockQuoteDependencies();

            // Test
            viewModel.Send.Execute(null);

            // Verify
            var expected = viewModel.State == "Sent" && !viewModel.Send.CanExecute(null);
            Assert.IsTrue(expected);
        }
Beispiel #5
0
        public void maintain_profile_when_generating_quote()
        {
            // Setup
            new Mock().PromiseEmailClient();
            new Mock().PromiseFileReader();

            Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1);

            EnterCustomer.ViewModel enterCustomerViewModel = null;

            Subscribe(Messages.REQUEST_VIEW_CUSTOMER_INFORMATION, obj =>
            {
                enterCustomerViewModel = CreateViewModel();
                AssignValues(enterCustomerViewModel);
                enterCustomerViewModel.SelectedServices = new List <Service>(obj as IEnumerable <Service>);
                enterCustomerViewModel.Load.Execute(null);
                enterCustomerViewModel.Generate.Execute(null);
            });

            var selectServicesViewModel = new CreateQuote.SelectServices.ViewModel();

            selectServicesViewModel.SelectedServices.Add(Mocks.SERVICE_1);
            selectServicesViewModel.Next.Execute(null);

            var calculateTransactionViewModel = new CalculateTransaction.ViewModel();

            calculateTransactionViewModel.Services.Add(Mocks.SERVICE_1);

            calculateTransactionViewModel.AddService.Execute(Mocks.SERVICE_1);
            enterCustomerViewModel.Generate.Execute(null);

            var viewQuoteViewModel = new ViewQuote.ViewModel();

            viewQuoteViewModel.Send.Execute(null);

            // Test
            MockEmailClient emailClient = null;

            Subscribe(Messages.REQUEST_EMAIL_CLIENT_RESPONSE, obj => emailClient = obj as MockEmailClient);
            Publish(Messages.REQUEST_EMAIL_CLIENT);

            // Verify
            var expected = emailClient != null && !string.IsNullOrEmpty(viewQuoteViewModel.Quote.Profile.Email);

            Assert.IsTrue(expected);
        }
Beispiel #6
0
        public void button_state_updates_after_sending_quote()
        {
            // Setup
            new Bootstrap().Run();

            var viewModel = new ViewQuote.ViewModel();

            new Mock().PromiseEmailClient();
            MockQuoteDependencies();

            // Test
            viewModel.Send.Execute(null);

            // Verify
            var expected = viewModel.State == "Sent" && !viewModel.Send.CanExecute(null);

            Assert.IsTrue(expected);
        }
Beispiel #7
0
        public void generate_quote()
        {
            // Setup
            new Mock().PromiseFileReader();

            Subscribe(Messages.REQUEST_VIEW_CUSTOMER_INFORMATION, obj =>
            {
                var enterCustomerViewModel = CreateViewModel();
                AssignValues(enterCustomerViewModel);
                enterCustomerViewModel.SelectedServices = new List <Service>(obj as IEnumerable <Service>);
                enterCustomerViewModel.Load.Execute(null);
                enterCustomerViewModel.Generate.Execute(null);
            });

            Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1);

            var selectServicesViewModel = new CreateQuote.SelectServices.ViewModel();

            selectServicesViewModel.SelectedServices.Add(Mocks.SERVICE_1);

            selectServicesViewModel.Next.Execute(null);

            var calculateTransactionViewModel = new CalculateTransaction.ViewModel();

            calculateTransactionViewModel.Services.Add(Mocks.SERVICE_1);

            // Test
            calculateTransactionViewModel.AddService.Execute(Mocks.SERVICE_1);

            var viewQuoteViewModel = new ViewQuote.ViewModel();

            // Verify
            var expected = !string.IsNullOrWhiteSpace(viewQuoteViewModel.File.Html);

            Assert.IsTrue(expected);
        }
Beispiel #8
0
        public void generate_statement_number()
        {
            // Setup
            new Mock().PromiseFileReader();
            new Mock().PromiseEmailClient();

            Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1);

            EnterCustomer.ViewModel enterCustomerViewModel = null;

            Subscribe(Messages.REQUEST_VIEW_CUSTOMER_INFORMATION, obj =>
                {
                    enterCustomerViewModel = CreateViewModel();
                    AssignValues(enterCustomerViewModel);
                    enterCustomerViewModel.SelectedServices = new List<Service>(obj as IEnumerable<Service>);
                    enterCustomerViewModel.Load.Execute(null);
                    enterCustomerViewModel.Generate.Execute(null);
                });

            var selectServicesViewModel = new CreateQuote.SelectServices.ViewModel();
            selectServicesViewModel.SelectedServices.Add(Mocks.SERVICE_1);
            selectServicesViewModel.Next.Execute(null);

            var calculateTransactionViewModel = new CalculateTransaction.ViewModel();
            calculateTransactionViewModel.Services.Add(Mocks.SERVICE_1);

            calculateTransactionViewModel.AddService.Execute(Mocks.SERVICE_1);
            enterCustomerViewModel.Generate.Execute(null);

            // Test
            var viewQuoteViewModel_1 = new ViewQuote.ViewModel();
            viewQuoteViewModel_1.Send.Execute(null);
            viewQuoteViewModel_1.Home.Execute(null);

            var viewQuoteViewModel_2 = new ViewQuote.ViewModel();
            viewQuoteViewModel_2.Send.Execute(null);
            viewQuoteViewModel_2.Home.Execute(null);

            // Verify
            var expected = viewQuoteViewModel_1.Quote.StatementNumber == 1 &&
                           viewQuoteViewModel_2.Quote.StatementNumber == 2;
            Assert.IsTrue(expected);
        }
Beispiel #9
0
        public void maintain_profile_when_generating_quote()
        {
            // Setup
            new Mock().PromiseEmailClient();
            new Mock().PromiseFileReader();

            Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1);

            EnterCustomer.ViewModel enterCustomerViewModel = null;

            Subscribe(Messages.REQUEST_VIEW_CUSTOMER_INFORMATION, obj =>
                {
                    enterCustomerViewModel = CreateViewModel();
                    AssignValues(enterCustomerViewModel);
                    enterCustomerViewModel.SelectedServices = new List<Service>(obj as IEnumerable<Service>);
                    enterCustomerViewModel.Load.Execute(null);
                    enterCustomerViewModel.Generate.Execute(null);
                });

            var selectServicesViewModel = new CreateQuote.SelectServices.ViewModel();
            selectServicesViewModel.SelectedServices.Add(Mocks.SERVICE_1);
            selectServicesViewModel.Next.Execute(null);

            var calculateTransactionViewModel = new CalculateTransaction.ViewModel();
            calculateTransactionViewModel.Services.Add(Mocks.SERVICE_1);

            calculateTransactionViewModel.AddService.Execute(Mocks.SERVICE_1);
            enterCustomerViewModel.Generate.Execute(null);

            var viewQuoteViewModel = new ViewQuote.ViewModel();
            viewQuoteViewModel.Send.Execute(null);

            // Test
            MockEmailClient emailClient = null;
            Subscribe(Messages.REQUEST_EMAIL_CLIENT_RESPONSE, obj => emailClient = obj as MockEmailClient);
            Publish(Messages.REQUEST_EMAIL_CLIENT);

            // Verify
            var expected = emailClient != null && !string.IsNullOrEmpty(viewQuoteViewModel.Quote.Profile.Email);
            Assert.IsTrue(expected);
        }
Beispiel #10
0
        public void generate_quote()
        {
            // Setup
            new Mock().PromiseFileReader();

            Subscribe(Messages.REQUEST_VIEW_CUSTOMER_INFORMATION, obj =>
                {
                    var enterCustomerViewModel = CreateViewModel();
                    AssignValues(enterCustomerViewModel);
                    enterCustomerViewModel.SelectedServices = new List<Service>(obj as IEnumerable<Service>);
                    enterCustomerViewModel.Load.Execute(null);
                    enterCustomerViewModel.Generate.Execute(null);
                });

            Publish(Messages.REQUEST_SAVE_SERVICE, Mocks.SERVICE_1);

            var selectServicesViewModel = new CreateQuote.SelectServices.ViewModel();
            selectServicesViewModel.SelectedServices.Add(Mocks.SERVICE_1);

            selectServicesViewModel.Next.Execute(null);

            var calculateTransactionViewModel = new CalculateTransaction.ViewModel();
            calculateTransactionViewModel.Services.Add(Mocks.SERVICE_1);

            // Test
            calculateTransactionViewModel.AddService.Execute(Mocks.SERVICE_1);

            var viewQuoteViewModel = new ViewQuote.ViewModel();

            // Verify
            var expected = !string.IsNullOrWhiteSpace(viewQuoteViewModel.File.Html);
            Assert.IsTrue(expected);
        }