public void If_Username_Parameter_Is_Empty_Should_Throw_Argument_Null_Exception(string findUsername)
        {
            //Arrange
            extendedDatabase.Add(person);

            //Act - Assert
            Assert.Throws <ArgumentNullException>(() => extendedDatabase.FindByUsername(findUsername));
        }
        public void Find_By_User_Name_With_Not_Exist_Person()
        {
            var database = new
                           ExtendedDatabase.ExtendedDatabase();

            Assert.Throws <InvalidOperationException>(() => database.FindByUsername("Ivo"));
        }
        public void Find_By_User_Name_With_Null_Name()
        {
            var database = new
                           ExtendedDatabase.ExtendedDatabase();

            database.Add(new ExtendedDatabase.Person(1, "Iva"));
            Assert.Throws <ArgumentNullException>(() => database.FindByUsername(null));
        }
        public void Find_By_User_Name_Success()
        {
            var database = new
                           ExtendedDatabase.ExtendedDatabase();

            var ivo = new ExtendedDatabase.Person(1, "Ivo");

            database.Add(ivo);
            var person = database.FindByUsername("Ivo");

            Assert.AreEqual(person, ivo);
        }
Example #5
0
 public void FindByUsername_EmptyUserParameter()
 {
     Assert.That(() => database.FindByUsername(string.Empty), Throws.ArgumentNullException);
     Assert.That(() => database.FindByUsername(null), Throws.ArgumentNullException);
 }