コード例 #1
0
        public void GetStitchSummaries_Empty()
        {
            var target = new MasterStitchCache("1");
            var result = target.GetStitchSummaries();

            result.Count.Should().Be(0);

            // Do it a second time, because we cache result lists and want to make sure nothing changes
            result = target.GetStitchSummaries();
            result.Count.Should().Be(0);
        }
コード例 #2
0
        public void AddLocalStitch_Replace()
        {
            var target = new MasterStitchCache("1");

            target.AddLocalStitch("ABC", new StitchGroupName("A.B.C"));
            var result = target.GetStitchSummaries();

            result.Count.Should().Be(1);
            result[0].Id.Should().Be("ABC");

            target.AddLocalStitch("ABC", new StitchGroupName("A.B.D"));
            result = target.GetStitchSummaries();
            result.Count.Should().Be(1);
            result[0].Id.Should().Be("ABC");
            result[0].GroupName.VersionString.Should().Be("A.B.D");
        }
コード例 #3
0
        public void RemoveLocalStitch_Test()
        {
            var target = new MasterStitchCache("1");

            target.AddLocalStitch("ABC", new StitchGroupName("A.B.C"));
            target.RemoveLocalStitch("ABC");
            var result = target.GetStitchSummaries();

            result.Count.Should().Be(0);
        }
コード例 #4
0
        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");
        }