Пример #1
0
        public void Component_CanTest_IfEqualNull()
        {
            //Arrange
            NSAComponent comp = new NSAComponent();

            comp.ComponentID = 3;
            comp.Name        = "Swiss";
            comp.Category    = "Cheese";

            //Act
            bool actual = comp.Equals(null);

            //Assert
            bool expected = false;

            Assert.AreEqual(expected, actual, "Component is not handling if its equal to null correctly");
        }
Пример #2
0
        public void Component_ToString_ReturnsName()
        {
            //Arrange
            NSAComponent comp = new NSAComponent();

            comp.ComponentID = 3;
            comp.Name        = "Swiss";
            comp.Category    = "Cheese";

            //Act
            string actual = comp.ToString();

            //Assert
            string expected = "Swiss";

            Assert.AreEqual(expected, actual, "Component is returning its name with ToString correctly");
        }
Пример #3
0
        public void Component_StoresCorrect_Category()
        {
            //Arrange
            NSAComponent comp = new NSAComponent();

            comp.ComponentID = 3;
            comp.Name        = "Swiss";
            comp.Category    = "Cheese";

            //Act
            string actual = comp.Category;

            //Assert
            string expected = "Cheese";

            Assert.AreEqual(expected, actual, "Component is not storing Category correctly");
        }
Пример #4
0
        public void Component_StoreCorrect_ID()
        {
            //Arrange
            NSAComponent comp = new NSAComponent();

            comp.ComponentID = 3;
            comp.Name        = "Swiss";
            comp.Category    = "Cheese";

            //Act
            int actual = comp.ComponentID;

            //Assert
            int expected = 3;

            Assert.AreEqual(expected, actual, "Component is not storing ID correctly");
        }
Пример #5
0
        public void Component_CanTest_IfEqual()
        {
            //Arrange
            NSAComponent comp = new NSAComponent();

            comp.ComponentID = 3;
            comp.Name        = "Swiss";
            comp.Category    = "Cheese";

            NSAComponent tester = new NSAComponent();

            tester.ComponentID = 3;
            tester.Name        = "American";
            tester.Category    = "Cheese";

            //Act
            bool actual = comp.Equals(tester);

            //Assert
            bool expected = true;

            Assert.AreEqual(expected, actual, "Component is not testing if it is equal to another correctly");
        }