Esempio n. 1
0
        public void CanCreateNetwork()
        {
            NetworkBuilder builder = new NetworkBuilder();

            builder.CopyFrom(Network.Main);
            builder.SetName(null);
            Assert.Throws <InvalidOperationException>(() => builder.BuildAndRegister());
            builder.SetName("new");
            builder.AddAlias("newalias");
            var network = builder.BuildAndRegister();

            Assert.Throws <InvalidOperationException>(() => builder.BuildAndRegister());

            Assert.Equal(network, Network.GetNetwork("new"));
            Assert.Equal(network, Network.GetNetwork("newalias"));

            CanGetNetworkFromName();

            Assert.True(Network.GetNetworks().Contains(network));
        }