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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
/// <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); } }