Пример #1
0
        public void ClosestPointsFinderCalculateHandler_SendsMessage_ForMessage(
            [NotNull, Frozen] ISelkieInMemoryBus bus,
            [NotNull, Frozen] ISettingsManager manager,
            [NotNull, Frozen] IClosestPointsFinder finder,
            [NotNull] ClosestPointsFinderModel sut,
            [NotNull] ClosestIdsCalculateMessage message)
        {
            // Arrange
            SetupSettingsManager(manager);

            var expected = new[]
            {
                1,
                2,
                3
            };

            finder.ClosestIds.Returns(expected);

            // Act
            sut.ClosestPointsFinderCalculateHandler(message);

            // Assert
            bus.Received()
            .PublishAsync(Arg.Is <ClosestIdsChangedMessage>(x => expected.SequenceEqual(x.ClosestPointIds)));
        }
Пример #2
0
 public void Constructor_SetsClosestIds_WhenCreated(
     [NotNull] ClosestPointsFinderModel sut)
 {
     // Arrange
     // Act
     // Assert
     Assert.NotNull(sut.ClosestIds);
 }
Пример #3
0
 public void Constructor_SubscribeToClosestIdsRequestMessage_WhenCreated(
     [NotNull, Frozen] ISelkieInMemoryBus bus,
     [NotNull] ClosestPointsFinderModel sut)
 {
     // Arrange
     // Act
     // Assert
     bus.Received().SubscribeAsync(sut.GetType().FullName,
                                   Arg.Any <Action <ClosestIdsRequestMessage> >());
 }
Пример #4
0
        public void ClosestPointsFinderCalculateHandler_CallsRun_ForMessage(
            [NotNull, Frozen] ISelkieInMemoryBus bus,
            [NotNull, Frozen] ISettingsManager manager,
            [NotNull, Frozen] IClosestPointsFinder finder,
            [NotNull] ClosestPointsFinderModel sut,
            [NotNull] ClosestIdsCalculateMessage message)
        {
            // Arrange
            SetupSettingsManager(manager);

            // Act
            sut.ClosestPointsFinderCalculateHandler(message);

            // Assert
            finder.Received().Run(Arg.Is <IApplicationArguments>(x => x.Source == "Test.txt" &&
                                                                 x.NumberOfClosestPoints == 3 &&
                                                                 x.QueryPointCoordinates == "1 2 3" &&
                                                                 x.ShiftPointCoordinates == "4 5 6"));
        }