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(); }
/// <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(); }
public void ShouldCreateLocalNode() { var network1 = InProcessNetwork.Create(); var node1 = network1.Local; node1.ShouldNotBeNull(); node1.Address.AsString.ShouldEqual(InProcessNetwork.SchemaName + ":ShouldCreateLocalNode"); }
/// <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); }
private void AddNetwork(InProcessNetwork network) { Contract.Requires(!Networks.Contains(network)); Networks.Add(this); }