public void Constructor_SubscribeToQueryPointSetMessage_WhenCreated(
     [NotNull, Frozen] ISelkieInMemoryBus bus,
     [NotNull] QueryPointModel sut)
 {
     // Arrange
     // Act
     // Assert
     bus.Received().SubscribeAsync(sut.GetType().FullName,
                                   Arg.Any <Action <QueryPointSetMessage> >());
 }
        public void QueryPointSetHandler_SetsZ_ForMessage(
            [NotNull] QueryPointModel sut,
            [NotNull] QueryPointSetMessage message)
        {
            // Arrange
            // Act
            sut.QueryPointSetHandler(message);

            // Assert
            Assert.AreEqual(message.Z,
                            sut.Z);
        }
        public void QueryPointSetHandler_SendsMessage_ForMessage(
            [NotNull, Frozen] ISelkieInMemoryBus bus,
            [NotNull] QueryPointModel sut,
            [NotNull] QueryPointSetMessage message)
        {
            // Arrange
            // Act
            sut.QueryPointSetHandler(message);

            // Assert
            bus.Received().PublishAsync(Arg.Is <QueryPointChangedMessage>(x => Math.Abs(x.X - message.X) < Tolerance &&
                                                                          Math.Abs(x.Y - message.Y) < Tolerance &&
                                                                          Math.Abs(x.Z - message.Z) < Tolerance));
        }
        private void SetXyzValues(
            [NotNull] QueryPointModel model,
            double x,
            double y,
            double z)
        {
            var setMessage = new QueryPointSetMessage
            {
                X = x,
                Y = y,
                Z = z
            };

            model.QueryPointSetHandler(setMessage);
        }
        public void QueryPointRequestHandler_SendsMessage_ForMessage(
            [NotNull, Frozen] ISelkieInMemoryBus bus,
            [NotNull] QueryPointModel sut,
            [NotNull] QueryPointRequestMessage message)
        {
            // Arrange
            SetXyzValues(sut,
                         1.0,
                         2.0,
                         3.0);

            // Act
            sut.QueryPointRequestHandler(message);

            // Assert
            bus.Received().PublishAsync(Arg.Is <QueryPointChangedMessage>(x => Math.Abs(x.X - 1.0) < Tolerance &&
                                                                          Math.Abs(x.Y - 2.0) < Tolerance &&
                                                                          Math.Abs(x.Z - 3.0) < Tolerance));
        }