public void WhenInvalidBarcode_NothingDisplayed()
        {
            m_FakePriceLookup.Setup(p => p.GetPrice(It.IsAny<string>())).Throws(new Exception());

            ProductPricePresenter pos = new ProductPricePresenter(m_DisplayMock.Object, m_Scanner, m_FakePriceLookup.Object);

            m_Scanner.ScanBarcode("1234");
            m_DisplayMock.Verify(d => d.ShowError(), Times.Once());
        }
        private void Test_WhenBarcodeScanned_CorrectPriceDisplayed(string barcode, double price)
        {
            m_FakePriceLookup.Setup(p => p.GetPrice(It.IsAny<string>())).Returns(price);

            ProductPricePresenter pos = new ProductPricePresenter(m_DisplayMock.Object, m_Scanner, m_FakePriceLookup.Object);

            m_Scanner.ScanBarcode(barcode);
            m_DisplayMock.Verify(d => d.DisplayPrice(price), Times.Once());
        }
示例#3
0
        public ProductPriceView(Product product)
        {
            InitializeComponent();

            _presenter = new ProductPricePresenter(this, product);
        }