예제 #1
0
        public void ShouldNotShareNodes()
        {
            var network1 = InProcessNetwork.Create();
            var node1    = network1.Local;

            node1.ShouldNotBeType <InProcessProxyNode>();
            node1.ShouldBeType <Node>();

            var network2 = InProcessNetwork.Create("ShouldNotShareNodes2");
            var node2    = network2.Local;

            node2.ShouldNotBeType <InProcessProxyNode>();
            node2.ShouldBeType <Node>();

            node1.Connect(node2.Address);
            var network1Node2 = network1.FindOrDefault(node2.Address);

            network1Node2.ShouldBeType <InProcessProxyNode>();

            node2.ShouldNotBeType <InProcessProxyNode>();
            node2.ShouldBeType <Node>();

            node2.HasParent.ShouldBeTrue();
            node2.Address.Parent.Matches(node1.Address).ShouldBeTrue();

            network1Node2.HasParent.ShouldBeTrue();
            network1Node2.Address.Parent.Matches(node1.Address).ShouldBeTrue();

            node1.HasChild(node2.Address).ShouldBeTrue();

            var network2Node1 = network2.FindOrDefault(node1.Address);

            network2Node1.ShouldNotBeNull();
        }
예제 #2
0
        /// <summary>Initializes a new instance of the <see cref="InProcessProxyNode"/> class.</summary>
        /// <param name="address">The address.</param>
        /// <param name="network">The network.</param>
        internal InProcessProxyNode(NodeAddress address, InProcessNetwork network)
            : base(address, network)
        {
            this.network = network;

            Id = Guid.NewGuid();
        }
예제 #3
0
        public void ShouldCreateLocalNode()
        {
            var network1 = InProcessNetwork.Create();
            var node1    = network1.Local;

            node1.ShouldNotBeNull();
            node1.Address.AsString.ShouldEqual(InProcessNetwork.SchemaName + ":ShouldCreateLocalNode");
        }
예제 #4
0
        /// <summary>
        /// Factory method to create a new <see cref="InProcessNetwork"/>.
        /// </summary>
        /// <param name="testMethod">Name of the method that created this or other uniquely identifier to help with debugging</param>
        /// <returns>An <see cref="InProcessNetwork"/></returns>
        internal static InProcessNetwork Create([CallerMemberName] string testMethod = "")
        {
            var result = new InProcessNetwork()
            {
                testMemberName = testMethod
            };

            return(result);
        }
예제 #5
0
        private void AddNetwork(InProcessNetwork network)
        {
            Contract.Requires(!Networks.Contains(network));

            Networks.Add(this);
        }