Esempio n. 1
0
        public void ObserveCommandEvents_CommandHaveMultipleEventsWhenNotifying_ShouldYieldValue(
            [Frozen] TestScheduler scheduler,
            CommandEvents sut,
            TestCommandWithMultipleEvents command,
            string value)
        {
            //arrange
            scheduler.Schedule(TimeSpan.FromTicks(202), () => sut.NotifyEvent(command, value));

            //act
            var resultObserver = scheduler.Start(() => sut.ObserveCommandEvents <TestCommandWithMultipleEvents, string>(command), 500);

            //assert
            resultObserver.AssertExceptions();
            resultObserver.Values().ShouldAllBeEquivalentTo(new[] { value });
        }
Esempio n. 2
0
        public void ObserveCommandEvents_WhenNotifyingOtherType_ShouldNotYieldValue(
            [Frozen] TestScheduler scheduler,
            CommandEvents sut,
            TestCommandWithMultipleEvents command,
            int value)
        {
            //arrange
            scheduler.Schedule(TimeSpan.FromTicks(202), () => sut.NotifyEvent(command, value));

            //act
            var resultObserver = scheduler.Start(() => sut.ObserveCommandEvents <TestCommandWithMultipleEvents, string>(command), 500);

            //assert
            resultObserver.AssertExceptions();
            resultObserver.Values().Should().BeEmpty();
        }
Esempio n. 3
0
        public void ObserveCommandEvents_WithoutCommandAndWhenNotifyingOtherType_ShouldReturnCorrectValue(
            [Frozen] ThrowingTestScheduler scheduler,
            CommandEvents sut,
            TestCommandWithMultipleEvents command,
            string value)
        {
            //arrange
            scheduler.Schedule(TimeSpan.FromTicks(202), () => sut.NotifyEvent(command, value));

            //act
            var result = scheduler.Start(() => sut.ObserveCommandEvents <TestCommandWithMultipleEvents, int>());

            //assert
            result.AssertExceptions();
            result.Values().Should().BeEmpty();
        }