public void RemoveTest_ThrowError_EmptyArray() { Person[] people = new Person[1] { new Person(1, "Ivcho_55") }; ExtendDatabase db = new ExtendDatabase(people); db.Remove(); Assert.That(() => db.Remove(), Throws.InvalidOperationException.With.Message.EqualTo("Storage is Empty!")); }
public void FetchMethodTest() { ExtendDatabase db = new ExtendDatabase(new Person(1, "Ivcho_55"), new Person(2, "Ivcho_1255"), new Person(3, "Ivcho_55325")); db.Add(new Person(4, "IvanchoGolemeca")); db.Remove(); db.Remove(); db.Remove(); db.Remove(); Assert.That(db.Fetch(), Is.EquivalentTo(new Person[] { })); }
public void RemovePersonFromEmptyDB() { //Act ExtendDatabase db = new ExtendDatabase(); // Assert Assert.Throws <InvalidOperationException>(() => db.Remove()); }
public void RemoveTest() { Person[] people = new Person[1] { new Person(1, "Ivcho_55") }; ExtendDatabase db = new ExtendDatabase(people); db.Remove(); Assert.That(db.Fetch(), Is.EqualTo(new Person[] { })); }
public void RemoveLastPersonFromDB(long firstId, string firstUsername, long secondId, string secondUsername) { // Arrange var firstPerson = new Person(firstId, firstUsername); var secondPerson = new Person(secondId, secondUsername); // Act ExtendDatabase db = new ExtendDatabase(new List <Person>() { firstPerson, secondPerson }); db.Remove(); // Assert Assert.AreEqual(firstPerson, db.Elements[0], $"Remove {typeof(Person)} doesn't work"); }