Beispiel #1
0
 internal INetwork CopyInputNetwork(INetwork network)
 {
     INetwork copy = null;
     using (var provider = new NetworkToolProvider())
     {
         using (var copier = provider.GetCopier(network))
         {
             copier.CopyNodeData = copier.CopyEdgeData = true;
             copy = copier.CopyNetwork(network);
         }
     }
     return copy;
 }
        public void GetCopier_When_T_Is_IBasicAdjList()
        {
            //Arrange
            var provider = new NetworkToolProvider();

            //Act
            var copier = provider.GetCopier<IBasicAdjList>();

            //Assert
            Assert.NotNull(copier);
            Assert.IsType<BasicAdjListCopier>(copier);
        }
        public void GetCopier_When_Input_Is_IBasicAdjList()
        {
            //Arrange
            var mockNet = new Mock<IBasicAdjList>();
            var provider = new NetworkToolProvider();

            //Act
            var copier = provider.GetCopier(mockNet.Object);

            //Assert
            Assert.NotNull(copier);
            Assert.IsType<BasicAdjListCopier>(copier);
        }
        public void GetCopier_Throws_Ex_When_T_Is_ISymmetricMatrix()
        {
            //Arrange
            var provider = new NetworkToolProvider();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => provider.GetCopier<ISymmetricMatrix<double>>());
        }
        public void GetCopier_Throws_Ex_When_Input_Is_IFullMatrix()
        {
            //Arrange
            var mockNet = new Mock<IFullMatrix<double>>();
            var provider = new NetworkToolProvider();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => provider.GetCopier(mockNet.Object));
        }
        public void GetCopier_Returns_Null_When_Input_Is_INull()
        {
            //Arrange
            IBasicAdjList net = null;
            var provider = new NetworkToolProvider();

            //Act
            var copier = provider.GetCopier(net);

            //Assert
            Assert.Null(copier);
        }