public void InitializeWithValidSessionIdBindsCorrectViewProperties()
        {
            // Arrange
            Mock<ICheckoutView> mockView = new Mock<ICheckoutView>();
            mockView.Setup(v => v.SessionID).Returns("123");
            mockView.SetupSet(v => v.Products = It.Is<List<ProductItem>>(i => i.Count == 3)).Verifiable();
            mockView.SetupSet(v => v.Total = It.Is<decimal>(t => t == 8.97m)).Verifiable();
            mockView.SetupSet(v => v.SubTotal = It.Is<decimal>(t => t == 8.97m)).Verifiable();
            mockView.SetupSet(v => v.Discount = It.Is<decimal>(t => t == 0m)).Verifiable();

            Mock<INavigationService> mockNavigator = new Mock<INavigationService>();

            CheckoutPresenter presenter = new CheckoutPresenter(mockView.Object, mockNavigator.Object, GetCheckoutServiceStub());

            // Act
            presenter.Initialize();

            // Assert
            mockView.Verify();
        }
Пример #2
0
        public void InitializeWithValidSessionIdBindsCorrectViewProperties()
        {
            // Arrange
            Mock <ICheckoutView> mockView = new Mock <ICheckoutView>();

            mockView.Setup(v => v.SessionID).Returns("123");
            mockView.SetupSet(v => v.Products = It.Is <List <ProductItem> >(i => i.Count == 3)).Verifiable();
            mockView.SetupSet(v => v.Total    = It.Is <decimal>(t => t == 8.97m)).Verifiable();
            mockView.SetupSet(v => v.SubTotal = It.Is <decimal>(t => t == 8.97m)).Verifiable();
            mockView.SetupSet(v => v.Discount = It.Is <decimal>(t => t == 0m)).Verifiable();

            Mock <INavigationService> mockNavigator = new Mock <INavigationService>();

            CheckoutPresenter presenter = new CheckoutPresenter(mockView.Object, mockNavigator.Object, GetCheckoutServiceStub());

            // Act
            presenter.Initialize();

            // Assert
            mockView.Verify();
        }
Пример #3
0
 private void Checkout_Load(object sender, EventArgs e)
 {
     _presenter.Initialize();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     _presenter.Initialize();
 }