Ejemplo n.º 1
0
    public async Task ShouldNotifyCustomers()
    {
        await saga.Handle(rebookingWasProposed, context);

        Assert.AreEqual(2, context.SentMessages.Length);
        Assert.AreEqual(1, context.TimeoutMessages.Length);
        var processMessage = (NotifyCustomerAboutProposedRebooking)context.SentMessages[0].Message;

        Assert.AreEqual("Aircraft type was changed from Boeing 787 to Boeing 777", processMessage.ReasonForChange);
    }
Ejemplo n.º 2
0
    public async Task ShouldNotifyCustomersWhenRebookingWasProposed()
    {
        await saga.Handle(rebookingWasProposed, context);

        Assert.AreEqual(2, context.SentMessages.Length);
        Assert.AreEqual(1, context.TimeoutMessages.Length);

        var processMessage = (NotifyCustomerAboutProposedRebooking)context.SentMessages[0].Message;

        // also test how long the timeout was supposed to be.
        Assert.AreEqual(TimeSpan.FromSeconds(15), context.TimeoutMessages[0].Within);
        Assert.AreEqual("Aircraft type was changed from Boeing 787 to Boeing 777", processMessage.ReasonForChange);
    }
Ejemplo n.º 3
0
    public async Task ShouldNotNotifyCustomers()
    {
        await saga.Handle(proposedRebookingWasRejected, context);

        var rebookingWasProposed = new RebookingWasProposed(
            bookingReferenceId,
            "Aircraft type was changed from Boeing 787 to Boeing 777");

        await saga.Handle(rebookingWasProposed, context);

        Assert.IsTrue(saga.Completed);
        Assert.AreEqual(0, context.SentMessages.Length);
        Assert.AreEqual(0, context.PublishedMessages.Length);
    }
Ejemplo n.º 4
0
    public async Task ShouldWaitUntilRebookingWasProposed()
    {
        await saga.Handle(proposedRebookingWasRejected, context);

        Assert.IsFalse(saga.Completed);
    }