Exemple #1
0
        public void AreEqual_ForNonEqualValues_ThrowsAssertionException()
        {
            string firstNameColumn = "firstName";
            string firstName       = "Barack";

            SetUpAreEqualTest(firstNameColumn, "SomeOtherFirstName");

            DbAssert.ForTable("Person").WithColumnValuePair("x", "y").AreEqual(firstNameColumn, firstName);
        }
Exemple #2
0
        public void NotExists_ForExistingValue_ThrowsAssertionException()
        {
            string columnName  = "Surname";
            string columnValue = "Obama";

            SetUpExistsTest(1);

            DbAssert.ForTable("Person").WithColumnValuePair(columnName, columnValue).NotExists();
        }
Exemple #3
0
        public void AreEqual_ForEqualValues_NothingHappens()
        {
            string firstNameColumn = "firstName";
            string firstName       = "Barack";

            SetUpAreEqualTest(firstNameColumn, firstName);

            DbAssert.ForTable("Person").WithColumnValuePair("x", "y").AreEqual(firstNameColumn, firstName);
        }
Exemple #4
0
        public void NotExists_ForNonExistingValue_NothingHappens()
        {
            string columnName  = "Surname";
            string columnValue = "Obama";

            SetUpExistsTest(0);

            DbAssert.ForTable("Person").WithColumnValuePair(columnName, columnValue).NotExists();
        }
Exemple #5
0
        public void AreEqual_ShouldBeAble_NoExceptionThrown()
        {
            string lastName  = "Bulgakov";
            string firstName = "Mikhail";
            int    id        = InsertPerson(lastName, firstName);

            DbAssert.ForTable("Person")
            .WithColumnValuePair("IdPerson", id)
            .AreEqual("LastName", lastName);
        }
Exemple #6
0
        public void NotExists_ExistsInDatabase_ThrowsAssertionException()
        {
            string lastName  = "Bulgakov";
            string firstName = "Mikhail";
            int    id        = InsertPerson(lastName, firstName);

            DbAssert.ForTable("Person")
            .WithColumnValuePair("IdPerson", id)
            .NotExists();
        }
Exemple #7
0
        public void Exists_ExistsInDatabase_NoExceptionThrown()
        {
            string lastName  = "Stoltenberg";
            string firstName = "Jens";
            int    id        = InsertPerson(lastName, firstName);

            DbAssert.ForTable("Person")
            .WithColumnValuePair("IdPerson", id)
            .Exists();
        }
Exemple #8
0
        public void IncRowVersion_HappyDays_IncreasesVersionInDatabase()
        {
            int id         = NextId();
            int rowVersion = 1;

            DataBoy.ForTable("Person")
            .Row("IdPerson", id)
            .D("FirstName", "Petter")
            .D("LastName", "Hansen")
            .D("Version", rowVersion)
            .Commit();

            Adversary.ForTable("Person").IdentifiedBy("IdPerson", id).IncRowVersion("Version");

            DbAssert.ForTable("Person").WithColumnValuePair("IdPerson", id).AreEqual("Version", rowVersion + 1);
        }
Exemple #9
0
        public void Evaluate_IsTrue_NothingHappens()
        {
            SetUpEvaluateTest();

            DbAssert.ForTable("Person").WithColumnValuePair("x", "y").Evaluate(x => true);
        }
Exemple #10
0
        public void Evaluate_IsFalse_ThrowsAssertionException()
        {
            SetUpEvaluateTest();

            DbAssert.ForTable("Person").WithColumnValuePair("x", "y").Evaluate(x => false);
        }
Exemple #11
0
 public void NotExists_DoesNotExistInDatabase_NoExceptionThrown()
 {
     DbAssert.ForTable("Person")
     .WithColumnValuePair("IdPerson", NextId())
     .NotExists();
 }
Exemple #12
0
 public void Exists_DoesNotExistInDatabase_ThrowsAssertionException()
 {
     DbAssert.ForTable("Person")
     .WithColumnValuePair("IdPerson", 12)
     .Exists();
 }