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))); }
public void Constructor_SetsClosestIds_WhenCreated( [NotNull] ClosestPointsFinderModel sut) { // Arrange // Act // Assert Assert.NotNull(sut.ClosestIds); }
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> >()); }
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")); }