Esempio n. 1
0
        public void ChemicalCastToBook()
        {
            string             testName       = "Poison";
            float              testPrice      = 2.5f;
            string             testType       = "Medicine";
            HouseholdChemicals chemicalToTest = new HouseholdChemicals(testName, testType, testPrice);

            string ex_name      = "Poison";
            float  ex_price     = 2.5f;
            string ex_type      = "Medicine";
            Book   bookExpected = new Book(ex_name, ex_type, ex_price);

            Assert.AreEqual(bookExpected, (Book)chemicalToTest);
        }
Esempio n. 2
0
        public void ChemicalCastToTechnic()
        {
            string             testName       = "Poison";
            float              testPrice      = 2.5f;
            string             testType       = "Medicine";
            HouseholdChemicals chemicalToTest = new HouseholdChemicals(testName, testType, testPrice);

            string  ex_name         = "Poison";
            float   ex_price        = 2.5f;
            string  ex_type         = "Medicine";
            Technic technicExpected = new Technic(ex_name, ex_type, ex_price);

            Assert.AreEqual(technicExpected, (Technic)chemicalToTest);
        }
Esempio n. 3
0
        public void TechnicCastToTechnic()
        {
            string  testName      = "Nintendo DSI";
            float   testPrice     = 1232f;
            string  testType      = "Porhorror game console";
            Technic technicToTest = new Technic(testName, testType, testPrice);

            string             ex_name          = "Nintendo DSI";
            float              ex_price         = 1232f;
            string             ex_type          = "Porhorror game console";
            HouseholdChemicals chemicalExpected = new HouseholdChemicals(ex_name, ex_type, ex_price);

            Assert.AreEqual(chemicalExpected, (HouseholdChemicals)technicToTest);
        }
Esempio n. 4
0
        public void ChemicalCastToFood()
        {
            string             testName       = "Poison";
            float              testPrice      = 2.5f;
            string             testType       = "Medicine";
            HouseholdChemicals chemicalToTest = new HouseholdChemicals(testName, testType, testPrice);

            string ex_name      = "Poison";
            float  ex_price     = 2.5f;
            string ex_type      = "Medicine";
            Food   foodExpected = new Food(ex_name, ex_type, ex_price);

            Assert.AreEqual(foodExpected, (Food)chemicalToTest);
        }
Esempio n. 5
0
        public void BookCastToBook()
        {
            string testName   = "Kerry";
            float  testPrice  = 232f;
            string testType   = "horror";
            Book   bookToTest = new Book(testName, testType, testPrice);

            string             ex_name          = "Kerry";
            float              ex_price         = 232f;
            string             ex_type          = "horror";
            HouseholdChemicals chemicalExpected = new HouseholdChemicals(ex_name, ex_type, ex_price);

            Assert.AreEqual(chemicalExpected, (HouseholdChemicals)bookToTest);
        }
Esempio n. 6
0
        public void FoodCastToFood()
        {
            string testName   = "Pizza";
            float  testPrice  = 2.5f;
            string testType   = "Italian Cuisine";
            Food   foodToTest = new Food(testName, testType, testPrice);

            string             ex_name          = "Pizza";
            float              ex_price         = 2.5f;
            string             ex_type          = "Italian Cuisine";
            HouseholdChemicals chemicalExpected = new HouseholdChemicals(ex_name, ex_type, ex_price);

            Assert.AreEqual(chemicalExpected, (HouseholdChemicals)foodToTest);
        }
Esempio n. 7
0
        public void ChemicalCreation()
        {
            string             testName       = "Poison";
            float              testPrice      = 2.5f;
            string             testType       = "Medicine";
            HouseholdChemicals chemicalToTest = new HouseholdChemicals(testName, testType, testPrice);

            string             ex_name          = "Poison";
            float              ex_price         = 2.5f;
            string             ex_type          = "Medicine";
            HouseholdChemicals chemicalExpected = new HouseholdChemicals(ex_name, ex_type, ex_price);

            Assert.AreEqual(chemicalExpected, chemicalToTest);
        }
Esempio n. 8
0
        public void ChemicalAddition()
        {
            string             test1Name       = "Poison";
            float              test1Price      = 2.5f;
            string             test1Type       = "Medicine";
            HouseholdChemicals chemicalToTest1 = new HouseholdChemicals(test1Name, test1Type, test1Price);

            string             test2Name       = "Acetyl acid";
            float              test2Price      = 3.5f;
            string             test2Type       = "Medicine";
            HouseholdChemicals chemicalToTest2 = new HouseholdChemicals(test2Name, test2Type, test2Price);


            string             ex_name          = "Poison - Acetyl acid";
            float              ex_price         = 3f;
            string             ex_type          = "Medicine";
            HouseholdChemicals chemicalExpected = new HouseholdChemicals(ex_name, ex_type, ex_price);

            Assert.AreEqual(chemicalExpected, chemicalToTest1 + chemicalToTest2);
        }
Esempio n. 9
0
        /// <summary>
        /// Comparing
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>If equal / unequal <=> true / false</returns>
        public override bool Equals(object obj)
        {
            if (obj is HouseholdChemicals)
            {
                HouseholdChemicals chemical = obj as HouseholdChemicals;

                if (this.Name == chemical.Name && this.Price == chemical.Price && this.Type == chemical.Type)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }