public void ReturnsEmptyList()
        {
            Mock <BSBaseComponent> componentMock = new Mock <BSBaseComponent>();

            BSManager.AddComponent(componentMock.Object);
            IList <BSBaseComponent> receivedPredecessors = BSManager.PredecessorsForComponent(componentMock.Object);

            Assert.AreEqual(0, receivedPredecessors.Count);
        }
        public void AddsPredecessorsSuccessfully()
        {
            Mock <BSBaseComponent> componentMock   = new Mock <BSBaseComponent>();
            Mock <BSBaseComponent> predecessorMock = new Mock <BSBaseComponent>();

            BSManager.AddComponent(componentMock.Object);
            BSManager.AddComponent(predecessorMock.Object);
            BSManager.AddPredecessorForComponent(componentMock.Object, predecessorMock.Object);
            IList <BSBaseComponent> receivedPredecessors = BSManager.PredecessorsForComponent(componentMock.Object);

            Assert.IsTrue(receivedPredecessors.Contains(predecessorMock.Object));
            Assert.AreEqual(1, receivedPredecessors.Count);
        }
Exemplo n.º 3
0
        public void LinksComponentsSuccessfullyIfEverythingIsGood()
        {
            BSManager.AddComponentWithNameAndRectangle(inputComponentName, new Rectangle(0, 0, width, height));
            BSBaseComponent input = BSManager.Components[0];

            BSManager.AddComponentWithNameAndRectangle(preprocessorComponentName, new Rectangle(width + distanceBetweenRects, 0, width, height));
            BSBaseComponent preprocessor = BSManager.Components[1];

            BSManager.LinkComponentsAtPoints(new Point(rnd.Next(width), rnd.Next(height)),
                                             new Point(rnd.Next(width + distanceBetweenRects, 2 * width + distanceBetweenRects), rnd.Next(height)));
            IList <BSBaseComponent> actualSuccs = BSManager.SuccessorsForComponent(input), actualPreds = BSManager.PredecessorsForComponent(preprocessor);

            Assert.AreEqual(1, actualSuccs.Count); Assert.AreEqual(1, actualPreds.Count);
            Assert.AreSame(preprocessor, actualSuccs[0]);
            Assert.AreSame(input, actualPreds[0]);
        }
        public void ThrowsKeyNotFoundException()
        {
            Mock <BSBaseComponent> componentMock = new Mock <BSBaseComponent>();

            BSManager.PredecessorsForComponent(componentMock.Object);
        }