/// <summary> /// Craig Barkley /// Created: 02/06/2019 /// BtnPetTypeAction_Click /// <summary> /// Button Type Action click. /// </summary> /// <param name="IPetTypeManager petTypeManager">The button BtnPetTypeAction calls AddPetType.</param> /// <returns></returns> //Method for creating a new Pet private void BtnPetTypeAction_Click(object sender, RoutedEventArgs e) { if (createNewPetType()) { try { var result = _petTypeManager.AddPetType(_newPetType); //add if this returns true if (result == true) { this.DialogResult = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Pet Type Added"); } } }
public void TestCreatePetTypeValidInput() { bool expectedResult = true; bool actualResult; // arrange PetType testPetType = new PetType() { PetTypeID = "GoodID", Description = "Good Long Description", }; // act actualResult = petManager.AddPetType(testPetType); // assert - check if PetType was added Assert.AreEqual(expectedResult, actualResult); }