Exemplo n.º 1
0
        public void ShouldReturnFalseForSequenceDiagramIsEmpty()
        {
            //Arrange
            var sdType = new SDType("SharpDox.UML.Tests.DiagramExtensionsTests", "DiagramExtensionTests", new SDNamespace("SharpDox.UML.Tests"));

            sdType.IsProjectStranger = false;
            var sdMethod = new SDMethod("SharpDox.UML.Tests.DiagramExtensionsTests.Method1", "Method1");

            var sdNode = new SDTargetNode();

            sdNode.CalledMethod = new SDMethod("SharpDox.UML.Tests.DiagramExtensionsTests.Method2", "Method2");
            sdNode.CallerMethod = sdMethod;
            sdNode.CallerType   = sdType;
            sdNode.CalledType   = sdType;

            //Add this node twice, because the check will skipp call number one
            //because this one is usually the first call to the method itself
            sdMethod.Calls.Add(sdNode);
            sdMethod.Calls.Add(sdNode);

            //Act
            var isEmpty = sdMethod.IsSequenceDiagramEmpty();

            //Assert
            Assert.AreEqual(false, isEmpty);
        }
Exemplo n.º 2
0
        public void ShouldReturnTrueForSequenceDiagramIsEmpty()
        {
            //Arrange
            var sdMethod = new SDMethod("SharpDox.UML.Tests.DiagramExtensionsTests.Method1", "Method1");

            //Act
            var isEmpty = sdMethod.IsSequenceDiagramEmpty();

            //Assert
            Assert.AreEqual(true, isEmpty);
        }
Exemplo n.º 3
0
        public void ShouldReturnTrueForSequenceDiagramIsEmptyBecauseOnlyCallsToStrangers()
        {
            //Arrange
            var sdType   = new SDType("SharpDox.UML.Tests.DiagramExtensionsTests", "DiagramExtensionTests", new SDNamespace("SharpDox.UML.Tests"));
            var sdMethod = new SDMethod("SharpDox.UML.Tests.DiagramExtensionsTests.Method1", "Method1");

            var sdTypeStranger   = new SDType("System.String", "String", new SDNamespace("System"));
            var sdMethodStranger = new SDMethod("System.String.Method1", "Method1");

            var sdNode = new SDTargetNode();

            sdNode.CalledType   = sdTypeStranger;
            sdNode.CalledMethod = sdMethodStranger;
            sdNode.CallerMethod = sdMethod;
            sdNode.CallerType   = sdType;

            sdMethod.Calls.Add(sdNode);

            //Act
            var isEmpty = sdMethod.IsSequenceDiagramEmpty();

            //Assert
            Assert.AreEqual(true, isEmpty);
        }