public void StudentSmartGirlTest() { God god = new God(false); Student student = new Student("Антон"); SmartGirl girl = new SmartGirl("Анна"); IHasName result = god.MakeCouple(student, girl); Girl resultGirl = result as Girl; CheckGeneralGirlRequirements(resultGirl, girl.Name, student.Name + "овна"); }
public void WrongCoupleWomanTest() { try { God god = new God(); Girl girl = new Girl(NamesHelper.GenerateName(Sex.Woman)); SmartGirl smartGirl = new SmartGirl(NamesHelper.GenerateName(Sex.Woman)); god.MakeCouple(girl, smartGirl); Assert.Fail("No exception"); } catch (Exception ex) { if (!(ex is WrongCoupleException)) { Assert.Fail("Not WrongCoupleException"); } } }
public void BotanSmartGirlTest() { God god = new God(false); Botan student = new Botan("Антон"); SmartGirl girl = new SmartGirl("Анна"); IHasName result = god.MakeCouple(student, girl); Book book = result as Book; if (book != null) { Assert.AreEqual(book.Name, girl.Name); } else { Assert.Fail("Incorrect resul type"); } }
private static Human GenerateFemale() { var value = Random.NextDouble(); Human result; if (value < 0.33) { result = new Girl(); } else if (value < 0.66) { result = new PrettyGirl(); } else { result = new SmartGirl(); } result.Name = RandomString(Random.Next(5, 15)); return(result); }