Пример #1
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();
        }
Пример #2
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();
        }
Пример #3
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 });
        }
Пример #4
0
        public void ObserveCommandEvents_ShouldReturnCorrectValue(
            [Frozen] ThrowingTestScheduler scheduler,
            CommandEvents sut,
            TestCommand command,
            string value)
        {
            //arrange
            scheduler.Schedule(TimeSpan.FromTicks(202), () => sut.NotifyEvent(command, value));

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

            //assert
            result.AssertExceptions();
            result.Values().First().Should().Be(value);
        }