예제 #1
0
        public void StudioServerProxy_HasDependencies_GivenNodesAndDeleteAnyway_ShowDepenciesIsFalse()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mock1             = new Mock <IPopupController>();

            mock1.Setup(controller => controller.DeleteAnyway).Returns(true);
            CustomContainer.Register(mock1.Object);
            var mock = new Mock <IExplorerItemViewModel>();
            var dependencyGraphGenerator = new Mock <IDependencyGraphGenerator>();
            var value = new Graph("myGraph");

            value.Nodes.Add(new DependencyVisualizationNode("a", 2, 2, false, false));
            value.Nodes.Add(new DependencyVisualizationNode("b", 2, 2, false, false));
            dependencyGraphGenerator.Setup(generator => generator.BuildGraph(It.IsAny <StringBuilder>(), It.IsAny <string>(), It.IsAny <double>(), It.IsAny <double>(), It.IsAny <int>()))
            .Returns(value);
            var msgMock = new Mock <IExecuteMessage>();
            //------------Execute Test---------------------------
            var metaData = studioServerProxy.HasDependencies(mock.Object, dependencyGraphGenerator.Object, msgMock.Object, mock1.Object);

            //------------Assert Results-------------------------
            Assert.IsInstanceOfType(metaData, typeof(IDeletedFileMetadata));
            var deletedFileMetadata = metaData;

            Assert.IsNotNull(deletedFileMetadata);
            Assert.AreEqual(false, deletedFileMetadata.IsDeleted);
            Assert.AreEqual(false, deletedFileMetadata.ShowDependencies);
            Assert.AreEqual(mock1.Object.ApplyToAll, deletedFileMetadata.ApplyToAll);
            Assert.AreEqual(mock1.Object.DeleteAnyway, deletedFileMetadata.DeleteAnyway);
            Assert.AreEqual(mock.Object.ResourceId, deletedFileMetadata.ResourceId);
        }
예제 #2
0
        public void StudioServerProxy_HasDependencies_GivenNoNodes_ShowDepenciesIsFalse()
        {
            //------------Setup for test--------------------------
            var studioServerProxy = new StudioServerProxy(new Mock <ICommunicationControllerFactory>().Object, new Mock <IEnvironmentConnection>().Object);
            var mock = new Mock <IExplorerItemViewModel>();
            var dependencyGraphGenerator = new Mock <IDependencyGraphGenerator>();

            dependencyGraphGenerator.Setup(generator => generator.BuildGraph(It.IsAny <StringBuilder>(), It.IsAny <string>(), It.IsAny <double>(), It.IsAny <double>(), It.IsAny <int>()))
            .Returns(new Graph("myGraph"));
            var msgMock = new Mock <IExecuteMessage>();
            //------------Execute Test---------------------------
            var metaData = studioServerProxy.HasDependencies(mock.Object, dependencyGraphGenerator.Object, msgMock.Object, new Mock <IPopupController>().Object);

            //------------Assert Results-------------------------
            Assert.IsInstanceOfType(metaData, typeof(IDeletedFileMetadata));
            var deletedFileMetadata = metaData;

            Assert.IsNotNull(deletedFileMetadata);
            Assert.AreEqual(true, deletedFileMetadata.IsDeleted);
            Assert.AreEqual(false, deletedFileMetadata.ShowDependencies);
            Assert.AreEqual(mock.Object.ResourceId, deletedFileMetadata.ResourceId);
        }