public void Constructor_SendsMessage_WhenCalled(
            [NotNull] ISelkieInMemoryBus bus,
            [NotNull] IAntSettingsSourceFactory factory,
            [NotNull] IAntSettingsSource source)
        {
            // Arrange
            factory.Create(false,
                           0).ReturnsForAnyArgs(source);

            // Act
            // ReSharper disable once UnusedVariable
            var sut = new AntSettingsSourceManager(bus,
                                                   factory);

            // Assert
            bus.Received()
               .PublishAsync(Arg.Is <ColonyAntSettingsResponseMessage>(x =>
                                                                       x.IsFixedStartNode == source.IsFixedStartNode &&
                                                                       x.FixedStartNode == source.FixedStartNode));
        }
        public void ColonyAntSettingsSetHandler_CallsFactory_WhenCalled(
            [NotNull] ISelkieInMemoryBus bus,
            [NotNull] IAntSettingsSourceFactory factory,
            [NotNull] IAntSettingsSource source,
            [NotNull] ColonyAntSettingsSetMessage message)
        {
            // Arrange
            factory.Create(false,
                           0).ReturnsForAnyArgs(source);

            var sut = new AntSettingsSourceManager(bus,
                                                   factory);

            // Act
            // ReSharper disable once UnusedVariable
            sut.ColonyAntSettingsSetHandler(message);

            // Assert
            factory.Received().Create(message.IsFixedStartNode,
                                      message.FixedStartNode);
        }
        public void ColonyAntSettingsSetHandler_SetsSource_WhenCalled(
            [NotNull] ISelkieInMemoryBus bus,
            [NotNull] IAntSettingsSourceFactory factory,
            [NotNull] IAntSettingsSource source,
            [NotNull] ColonyAntSettingsSetMessage message)
        {
            // Arrange
            factory.Create(false,
                           0).ReturnsForAnyArgs(source);

            var sut = new AntSettingsSourceManager(bus,
                                                   factory);

            // Act
            // ReSharper disable once UnusedVariable
            sut.ColonyAntSettingsSetHandler(message);

            // Assert
            Assert.Equal(source,
                         sut.Source);
        }
        public void ColonyAntSettingsSetHandler_CallsSendResponseMessage_WhenCalled(
            [NotNull] ISelkieInMemoryBus bus,
            [NotNull] IAntSettingsSourceFactory factory,
            [NotNull] IAntSettingsSource source,
            [NotNull] ColonyAntSettingsSetMessage message)
        {
            // Arrange
            factory.Create(false,
                           0).ReturnsForAnyArgs(source);

            var sut = new AntSettingsSourceManager(bus,
                                                   factory);

            // Act
            sut.ColonyAntSettingsSetHandler(message);

            // Assert
            bus.Received()
               .PublishAsync(Arg.Is <ColonyAntSettingsResponseMessage>(x =>
                                                                       x.IsFixedStartNode == source.IsFixedStartNode &&
                                                                       x.FixedStartNode == source.FixedStartNode));
        }