public void Test_Find_FindsSalonInDatabase() { //Arrange Salon testSalon = new Salon("British Hairways", "a great salon"); testSalon.Save(); //Act Salon foundSalon = Salon.Find(testSalon.GetId()); //Assert Assert.Equal(testSalon, foundSalon); }
public void Test_Save_AssignsIdToSalonInDatabase() { //Arrange Salon testSalon = new Salon("British Hairways", "a great salon"); testSalon.Save(); //Act Salon savedSalon = Salon.GetAll()[0]; int testId = testSalon.GetId(); int expectedId = savedSalon.GetId(); //Assert Assert.Equal(testId, expectedId); }
public override bool Equals(System.Object otherSalon) { if (!(otherSalon is Salon)) { return(false); } else { Salon newSalon = (Salon)otherSalon; bool idEquality = this.GetId() == newSalon.GetId(); bool nameEquality = this.GetName() == newSalon.GetName(); bool aboutEquality = this.GetAbout() == newSalon.GetAbout(); return(idEquality && nameEquality && aboutEquality); } }
public void Test_GetStylists_ReturnsTrueIfListsAreTheSame() { //Arrange Salon newSalon = new Salon("British Hairways", "a great salon"); newSalon.Save(); Stylist firstTestStylist = new Stylist("Harry Cutter", "a great stylist", newSalon.GetId()); firstTestStylist.Save(); Stylist secondTestStylist = new Stylist("Dwayne Johnson", "a wonderful stylist", newSalon.GetId()); secondTestStylist.Save(); Stylist thirdTestStylist = new Stylist("Jason Statham", "a marvelous stylist", newSalon.GetId()); thirdTestStylist.Save(); List <Stylist> expectedList = Stylist.GetAll(); //Act List <Stylist> resultList = newSalon.GetStylists(); //Arrange Assert.Equal(resultList, expectedList); }
public void Test_Update_ReturnsTrueIfSalonInfoIsTheSame() { //Arrange Salon firstTestSalon = new Salon("British Hairways", "a great salon"); firstTestSalon.Save(); Salon secondTestSalon = new Salon("The Second Combing", "a wonderful salon", firstTestSalon.GetId()); //Act secondTestSalon.Update("British Hairways", "a great salon"); //Assert Assert.Equal(firstTestSalon, secondTestSalon); }
public void Test_Update_ReturnsTrueIfSalonIdsAreTheSame() { //Arrange Salon newSalon = new Salon("British Hairways", "a great salon"); newSalon.Save(); Stylist firstTestStylist = new Stylist("Harry Cutter", "a great stylist", newSalon.GetId()); firstTestStylist.Save(); Stylist secondTestStylist = new Stylist("Harry Cutter", "a great stylist", 3, firstTestStylist.GetId()); //Act secondTestStylist.Update(firstTestStylist.GetSalonId()); //Assert Assert.Equal(firstTestStylist, secondTestStylist); }
public void Test_Update_ReturnsTrueIfStylistInfoIsTheSame() { //Arrange Salon newSalon = new Salon("British Hairways", "a great salon"); newSalon.Save(); Stylist firstTestStylist = new Stylist("Harry Cutter", "a great stylist", newSalon.GetId()); firstTestStylist.Save(); Stylist secondTestStylist = new Stylist("Dwayne Johnson", "a wonderful stylist", newSalon.GetId(), firstTestStylist.GetId()); //Act secondTestStylist.Update("Harry Cutter", "a great stylist"); //Assert Assert.Equal(firstTestStylist, secondTestStylist); }