Esempio n. 1
0
        public async Task Should_Notify_On_Finish_When_Subscribed_To_Channel_PrinterDotPrintedDotCommandId_Only_When_CommandId_Is_Correct()
        {
            Guid incorrectId = Guid.Empty;
            bool areEqual    = false;

            var fn = new FakePrinterNotifier();

            var printBlack = new PrintBlackCommand(_content,
                                                   paperLevelIndicator: new EnoughPaperLevelStub(),
                                                   blackLevelIndicator: new EnoughBlackLevelStub(),
                                                   notifier: fn);

            await fn.Subscribe((message) => areEqual = true, PrinterNotificationTypes.Printed);

            await printBlack.Execute();

            Assert.IsFalse(areEqual);
        }
Esempio n. 2
0
        public async Task Should_Notify_On_Finish_When_Subscribed_To_Channel_PrinterDotPrintedDotCommandId()
        {
            bool areEqual = false;

            var fn = new FakePrinterNotifier();

            var printBlack = new PrintBlackCommand(_content,
                                                   paperLevelIndicator: new EnoughPaperLevelStub(),
                                                   blackLevelIndicator: new EnoughBlackLevelStub(),
                                                   notifier: fn);

            await fn.Subscribe((message) => areEqual = message.Equals($"Document {printBlack.Id} printed"),
                               PrinterNotificationTypes.Printed,
                               correlationId : printBlack.Id);

            await printBlack.Execute();

            Assert.IsTrue(areEqual);
        }