Beispiel #1
0
        public void MemberInfoTest()
        {
            var memberId = Guid.NewGuid();
            var address  = NetworkAddress.Parse("192.168.33.34:5569");
            var version  = new MemberVersion(4, 5, 6);


            var attributes = new Dictionary <string, string>
            {
                { "attribute", "value" }
            };
            var x = new MemberInfo(memberId, address, version, true, attributes);

            Console.WriteLine(x);

            Assert.That(x.Id, Is.EqualTo(memberId));
            Assert.That(x.Uuid, Is.EqualTo(memberId));
            Assert.That(x.Address, Is.SameAs(address));
            Assert.That(x.Version, Is.SameAs(version));
            Assert.That(x.IsLite, Is.True);
            Assert.That(x.IsLiteMember, Is.True);
            var a = x.Attributes;

            Assert.That(a.Count, Is.EqualTo(1));
            Assert.That(a["attribute"], Is.EqualTo("value"));

            Assert.That(x, Resolves.Equatable(
                            // weird indeed, but only the ID matters
                            new MemberInfo(memberId, x.Address, x.Version, x.IsLite, attributes),
                            new MemberInfo(Guid.NewGuid(), x.Address, x.Version, x.IsLite, attributes)
                            ));
        }
Beispiel #2
0
        public void DistributedObjectInfoTest()
        {
            var x = new DistributedObjectInfo("serviceName", "name");

            Console.WriteLine(x);

            Assert.That(x.ServiceName, Is.EqualTo("serviceName"));
            Assert.That(x.Name, Is.EqualTo("name"));

            Assert.That(x, Resolves.Equatable(
                            new DistributedObjectInfo("serviceName", "name"),
                            new DistributedObjectInfo("serviceName", "other"),
                            new DistributedObjectInfo("other", "other")));
        }