Example #1
0
        public void AddForReasonShowsTheAddCustomerToQueueView()
        {
            TestableRootWorkItem workItem = new TestableRootWorkItem();

            workItem.Services.AddNew <MockMessageBoxService, IMessageBoxService>();
            MockWorkspace workspace                    = workItem.Workspaces.AddNew <MockWorkspace>(WorkspaceNames.ModalWindows);
            MockFindCustomerResultsView view           = workItem.SmartParts.AddNew <MockFindCustomerResultsView>();
            WorkspaceLocatorService     locatorService =
                workItem.Services.AddNew <WorkspaceLocatorService, IWorkspaceLocatorService>();
            MockCustomerQueueService queueService = workItem.Services.AddNew <MockCustomerQueueService, ICustomerQueueService>();

            Customer customer = new Customer();

            Customer[] response = new Customer[] { customer };
            workItem.Items.Add(response, "FindCustomerResponse");


            workspace.Show(view);
            FindCustomerResultsViewPresenter presenter = workItem.Items.AddNew <FindCustomerResultsViewPresenter>();

            presenter.View = view;


            presenter.AddReasonForVisit(customer);

            Assert.IsTrue(CollectionUtilities.ContainsOneOf(workspace.SmartParts, typeof(IAddVisitorToQueueView)));
        }
Example #2
0
        public void ShowWithNoSPIAndNoWorkItemSetCreatesNew()
        {
            MockWorkspace ws = new MockWorkspace();

            ws.Show(new MockSP());

            Assert.AreEqual(1, ws.ShowCalls);
            Assert.IsNotNull(ws.LastSPI);
        }
Example #3
0
        public void ResolveToProviderIfNoWorkItem()
        {
            MockSPI        spi = new MockSPI();
            MockSPProvider sp  = new MockSPProvider(spi);
            MockWorkspace  ws  = new MockWorkspace();

            ws.Show(sp);

            Assert.AreSame(spi, ws.LastSPI);
        }
        public void CancelClosesViewOnTheWorkspace()
        {
            MockFindCustomerView mockView = workItem.SmartParts.AddNew <MockFindCustomerView>();

            mockWorkspace.Show(mockView);

            mockView.ClickCloseButton();

            Assert.AreEqual(0, mockWorkspace.SmartParts.Count);
        }
 public void Initialize()
 {
     workItem = new TestableRootWorkItem();
     workItem.Services.AddNew <WorkspaceLocatorService, IWorkspaceLocatorService>();
     mockWorkspace = workItem.Workspaces.AddNew <MockWorkspace>(WorkspaceNames.ModalWindows);
     queueService  = workItem.Services.AddNew <MockCustomerQueueService, ICustomerQueueService>();
     mockView      = workItem.SmartParts.AddNew <MockAddVisitorToQueueView>();
     presenter     = workItem.Items.AddNew <AddVisitorToQueueViewPresenter>();
     mockWorkspace.Show(mockView);
     presenter.View = mockView;
 }
Example #6
0
        public void SmartPartShowInChildWorkItemParentWorkspaceUsesChildSmartPartInfo()
        {
            WorkItem workItemA = new TestableRootWorkItem();
            WorkItem workItemB = workItemA.WorkItems.AddNew <WorkItem>();
            MockSP   sp        = new MockSP();
            MockSPI  spi       = new MockSPI("Title", "Description");

            MockWorkspace workspace = workItemA.Workspaces.AddNew <MockWorkspace>();

            workItemB.RegisterSmartPartInfo(sp, spi);

            workspace.Show(sp);

            Assert.AreSame(spi, workspace.LastSPI);
        }
Example #7
0
        public void SmartPartInfoIsRemovedWhenChildWorkItemIsDisposed()
        {
            WorkItem workItemA = new TestableRootWorkItem();
            WorkItem workItemB = workItemA.WorkItems.AddNew <WorkItem>();
            MockSP   sp        = new MockSP();
            MockSPI  spi       = new MockSPI("Title", "Description");

            MockWorkspace workspace = workItemA.Workspaces.AddNew <MockWorkspace>();

            workItemB.RegisterSmartPartInfo(sp, spi);

            workItemB.Dispose();

            workspace.Show(sp);

            Assert.IsFalse(spi == workspace.LastSPI);
        }
        public void Initialize()
        {
            workItem = new TestableRootWorkItem();
            workItem.Services.AddNew <WorkspaceLocatorService, IWorkspaceLocatorService>();
            workspace = workItem.Workspaces.AddNew <MockWorkspace>();

            queueEntry             = workItem.Items.AddNew <QueueEntry>("QueueEntry");
            queueEntry.Person      = new Customer();
            finderService          = workItem.Services.AddNew <MockCustomerFinderService, ICustomerFinderService>();
            queueService           = workItem.Services.AddNew <MockQueueService, ICustomerQueueService>();
            customerAccountService = workItem.Services.AddNew <MockCustomerAccountService, ICustomerAccountService>();
            alertService           = workItem.Services.AddNew <MockAlertService, ICustomerAlertService>();

            view           = workItem.SmartParts.AddNew <MockCustomerSummaryView>();
            presenter      = workItem.Items.AddNew <TestablePresenter>();
            presenter.View = view;
            workspace.Show(view);
        }
        public void Initialize()
        {
            Customer customer = new Customer();

            customer.CustomerId = "0001";
            workItem            = new TestableRootWorkItem();
            workItem.Services.AddNew <WorkspaceLocatorService, IWorkspaceLocatorService>();
            workspace    = workItem.Workspaces.AddNew <MockWorkspace>();
            entry        = workItem.Items.AddNew <QueueEntry>("QueueEntry");
            entry.Person = customer;

            finderService          = workItem.Services.AddNew <MockCustomerFinderService, ICustomerFinderService>();
            customerAccountService = workItem.Services.AddNew <MockCustomerAccountService, ICustomerAccountService>();
            accountService         = workItem.Services.AddNew <MockAccountService, IAccountService>();
            quoteService           = workItem.Services.AddNew <MockQuoteService, IQuoteService>();

            authService          = workItem.Services.AddNew <MockAuthenticationService, IAuthenticationService>();
            impersonationService = workItem.Services.AddNew <GenericPrincipalImpersonationService, IImpersonationService>();

            presenter      = workItem.Items.AddNew <TestablePresenter>();
            view           = workItem.Items.AddNew <MockPurchaseCDView>();
            presenter.View = view;
            workspace.Show(view);
        }