public void AddNodeStatus_Test() { var target = new MasterStitchCache("1"); var received = new ObjectReceivedEvent <NodeStatus> { FromNetworkId = "RemoteNetworkId", FromNodeId = "RemoteNodeId", Object = new NodeStatus { Id = "RemoteNodeId", Name = "RemoteNodeName", NetworkNodeId = "RemoteNetworkId", StitchInstances = new List <InstanceInformation> { new InstanceInformation { GroupName = "A.B.C", Id = "1", State = InstanceStateType.Running }, new InstanceInformation { GroupName = "A.B.C", Id = "2", State = InstanceStateType.Running }, new InstanceInformation { GroupName = "A.B.C", Id = "3", State = InstanceStateType.Stopped } } } }; target.AddNodeStatus(received, received.Object); var result = target.GetStitchSummaries().OrderBy(ss => ss.Id).ToList(); result.Count.Should().Be(2); result[0].Id.Should().Be("1"); result[1].Id.Should().Be("2"); result.Should().OnlyContain(ss => ss.GroupName.VersionString == "A.B.C"); result.Should().OnlyContain(ss => ss.NodeId == "RemoteNodeId"); result.Should().OnlyContain(ss => ss.NetworkNodeId == "RemoteNetworkId"); }
private static void ReceiveNodeStatus(ObjectReceivedEvent <NodeStatus> m) { _remoteNodeId = m.FromNodeId; }