public void Accept(NotifyStatusOperation operation) { AssignmentStateMachine stateMachine = AssertStateMachineIsAssigned(assignmentStateMachine); stateMachine.ExecuteIfInPhase<PhaseWaitingForSetupResponse>( phase => phase.NewAddress == operation.OriginatingAddress ? new PhaseAssignmentCompleted(null) : null); }
void IOperationAcceptor.Accept(NotifyStatusOperation operation) { }
public void When_reading_notify_status_operation_it_must_be_correct() { // Arrange byte[] buffer = { 2, ByteFor('5'), ByteFor('2'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('5'), ByteFor(':'), ByteFor('A'), ByteFor('B'), ByteFor('C'), ByteFor('D'), ByteFor('E'), ByteFor('F'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('6'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('9'), ByteFor(':'), ByteFor('3'), ByteFor('2'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('0'), ByteFor(':'), ByteFor('3'), ByteFor('2'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('1'), ByteFor(':'), ByteFor('2'), ByteFor('5'), ByteFor('3'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('2'), ByteFor(':'), ByteFor('2'), ByteFor('4'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('3'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('7'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), 3 }; var reader = new PacketReader(); // Act Operation operation = reader.Read(buffer); // Assert var expected = new NotifyStatusOperation(new WirelessNetworkAddress("ABCDEF"), true, DeviceCapabilities.TimeSensor, DeviceRoles.IntermediateTimer3, 253) { BatteryStatus = 241, IsAligned = true, ClockSynchronization = ClockSynchronizationStatus.RequiresSync }; operation.ShouldBeEquivalentTo(expected, options => options.IncludingAllRuntimeProperties()); }
public void Accept(NotifyStatusOperation operation) { using (var lockTracker = new LockTracker(InnerLog, MethodBase.GetCurrentMethod())) { lock (nonReentrantProcessIncomingOperationLock) { lockTracker.Acquired(); owner.HandleIncomingNotifyStatusOperation(operation); } } }
public void When_writing_notify_status_operation_it_must_be_correct() { // Arrange var operation = new NotifyStatusOperation(new WirelessNetworkAddress("ABCDEF"), true, DeviceCapabilities.TimeSensor, DeviceRoles.IntermediateTimer3, 253) { BatteryStatus = 241, IsAligned = true, ClockSynchronization = ClockSynchronizationStatus.RequiresSync }; // Act byte[] buffer = PacketWriter.Write(operation, false); // Assert buffer.ShouldBeEquivalentTo(new byte[] { 2, ByteFor('5'), ByteFor('2'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('5'), ByteFor(':'), ByteFor('A'), ByteFor('B'), ByteFor('C'), ByteFor('D'), ByteFor('E'), ByteFor('F'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('6'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('1'), ByteFor('9'), ByteFor(':'), ByteFor('3'), ByteFor('2'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('0'), ByteFor(':'), ByteFor('3'), ByteFor('2'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('1'), ByteFor(':'), ByteFor('2'), ByteFor('5'), ByteFor('3'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('2'), ByteFor(':'), ByteFor('2'), ByteFor('4'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('3'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), ByteFor('0'), ByteFor('2'), ByteFor('7'), ByteFor(':'), ByteFor('1'), ByteFor('\t'), 3 }); }