public void Accept(KeepAliveOperation operation)
            {
                AssignmentStateMachine stateMachine = AssertStateMachineIsAssigned(assignmentStateMachine);

                bool transitioned =
                    stateMachine.ExecuteIfInPhase<PhaseWaitingForLoginResponse>(
                        phase => new PhaseReadyForDeviceSetup(operation.MediatorStatus));

                if (!transitioned)
                {
                    stateMachine.ExecuteIfInPhase<PhaseWaitingForSetupResponse>(
                        phase =>
                            owner.IsConfiguringMediator
                                ? (AssignmentPhase) new PhaseAssignmentCompleted(operation.MediatorStatus)
                                : null);
                }
            }
 void IOperationAcceptor.Accept(KeepAliveOperation operation)
 {
 }
        public void When_reading_keep_alive_operation_it_must_be_correct()
        {
            // Arrange
            byte[] buffer =
            {
                2,
                ByteFor('5'),
                ByteFor('1'),
                ByteFor('\t'),
                ByteFor('0'),
                ByteFor('1'),
                ByteFor('0'),
                ByteFor(':'),
                ByteFor('1'),
                ByteFor('2'),
                ByteFor('3'),
                ByteFor('.'),
                ByteFor('4'),
                ByteFor('5'),
                ByteFor('6'),
                ByteFor('.'),
                ByteFor('7'),
                ByteFor('8'),
                ByteFor('9'),
                ByteFor('\t'),
                ByteFor('0'),
                ByteFor('1'),
                ByteFor('2'),
                ByteFor(':'),
                ByteFor('1'),
                ByteFor('\t'),
                3
            };
            var reader = new PacketReader();

            // Act
            Operation operation = reader.Read(buffer);

            // Assert
            var expected = new KeepAliveOperation(new Version(123, 456, 789), 1);
            operation.ShouldBeEquivalentTo(expected, options => options.IncludingAllRuntimeProperties());
        }
            public void Accept(KeepAliveOperation operation)
            {
                using (var lockTracker = new LockTracker(InnerLog, MethodBase.GetCurrentMethod()))
                {
                    lock (nonReentrantProcessIncomingOperationLock)
                    {
                        lockTracker.Acquired();

                        owner.HandleIncomingKeepAliveOperation(operation);
                    }
                }
            }
        public void When_writing_keep_alive_operation_it_must_be_correct()
        {
            // Arrange
            var operation = new KeepAliveOperation(new Version(123, 456, 789), 1);

            // Act
            byte[] buffer = PacketWriter.Write(operation, false);

            // Assert
            buffer.ShouldBeEquivalentTo(new byte[]
            {
                2,
                ByteFor('5'),
                ByteFor('1'),
                ByteFor('\t'),
                ByteFor('0'),
                ByteFor('1'),
                ByteFor('0'),
                ByteFor(':'),
                ByteFor('1'),
                ByteFor('2'),
                ByteFor('3'),
                ByteFor('.'),
                ByteFor('4'),
                ByteFor('5'),
                ByteFor('6'),
                ByteFor('.'),
                ByteFor('7'),
                ByteFor('8'),
                ByteFor('9'),
                ByteFor('\t'),
                ByteFor('0'),
                ByteFor('1'),
                ByteFor('2'),
                ByteFor(':'),
                ByteFor('1'),
                ByteFor('\t'),
                3
            });
        }