public void AddMorePersonsThanTheSizw() { var array = new Person[16] { new Person(1, "ivan1"), new Person(2, "ivan2"), new Person(3, "ivan3"), new Person(4, "ivan4"), new Person(5, "ivan5"), new Person(6, "ivan6"), new Person(7, "ivan7"), new Person(8, "ivan8"), new Person(9, "ivan9"), new Person(10, "ivan10"), new Person(11, "ivan11"), new Person(12, "ivan12"), new Person(13, "ivan13"), new Person(14, "ivan14"), new Person(15, "ivan15"), new Person(16, "ivan16"), }; var database = new ExtendedDatabasee(array); var person = new Person(17, "Ivan17"); Assert.Throws <InvalidOperationException>(() => database.Add(new Person(17, "Ivan17"))); }
public void ExceptionThereISUserWithThisId() { var array = new Person[1] { new Person(1, "ivan1"), }; var database = new ExtendedDatabasee(array); var person = new Person(1, "Ivan100"); Assert.Throws <InvalidOperationException>(() => database.Add(person)); }
public void ValidAddPerson() { var array = new Person[1] { new Person(1, "Ivan1"), }; var database = new ExtendedDatabasee(array); var person = new Person(2, "Ivan2"); database.Add(person); var expectedCount = 2; var resultCount = database.Count; Assert.IsTrue(expectedCount == resultCount); }