public void CheckIfThrowsExceptionWhenThereIsAlreadyAPersonWithThatNameOrId() { DatabaseExtended db = new DatabaseExtended(); db.Add(new Person(13, "Nick")); Assert.Throws <InvalidOperationException>(() => db.Add(new Person(13, "Nick"))); }
public void CheckIfPersonsIdIsNegative(long id) { DatabaseExtended db = new DatabaseExtended(); db.Add(new Person(12, "Todor")); Assert.Throws <InvalidOperationException>(() => db.FindById(id), "There is not people with such id!"); }
public void CheckIfContainsPersonWithSuchName() { DatabaseExtended db = new DatabaseExtended(); db.Add(new Person(12, "Todor")); Assert.Throws <InvalidOperationException>(() => db.FindByUsername(null), "The name should not be null!"); }
public void CheckIfContainsPersonWithSuchName(string name) { DatabaseExtended db = new DatabaseExtended(); db.Add(new Person(12, "Todor")); Assert.Throws <InvalidOperationException>(() => db.FindByUsername(name), "There is not such name"); }
public void CheckIfRemovesCorrectly() { DatabaseExtended db = new DatabaseExtended(); FieldInfo reflectedData = typeof(DatabaseExtended) .GetFields(BindingFlags.NonPublic | BindingFlags.Instance) .First(f => f.Name == ArrayName); IPerson person = new Person(13, "Nick"); db.Add(person); db.Remove(); IPerson[] people = (IPerson[])reflectedData.GetValue(db); Assert.That(people, !Does.Contain(person)); }