Esempio n. 1
0
        public void AlertScreen_WhenOnePurchaserCompletesTransaction()
        {
            // Arrange
            var alertScreenForCompletedPurchaser = new Mock <IAlertScreen>();
            var alertScreenForActivePurchaser    = new Mock <IAlertScreen>();
            var completedPurchaser = new Purchaser(alertScreenForCompletedPurchaser.Object, _mediator);
            var activePurchaser    = new Purchaser(alertScreenForActivePurchaser.Object, _mediator);

            // Act
            _mediator.AddPurchaser(completedPurchaser);
            _mediator.AddPurchaser(activePurchaser);
            completedPurchaser.Complete(_product);

            // Assert
            using (new FluentAssertions.Execution.AssertionScope("purchaser"))
            {
                alertScreenForActivePurchaser.Verify(sc => sc.ShowMessage(_product.Item, _product.Location));
                alertScreenForCompletedPurchaser.Verify(sc => sc.ShowMessage(It.IsAny <string>(), It.IsAny <string>()), Times.Never);
            }
        }