示例#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);
        }
示例#2
0
        public void NotExists_ForExistingValue_ThrowsAssertionException()
        {
            string columnName  = "Surname";
            string columnValue = "Obama";

            SetUpExistsTest(1);

            DbAssert.ForTable("Person").WithColumnValuePair(columnName, columnValue).NotExists();
        }
示例#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);
        }
示例#4
0
        public void NotExists_ForNonExistingValue_NothingHappens()
        {
            string columnName  = "Surname";
            string columnValue = "Obama";

            SetUpExistsTest(0);

            DbAssert.ForTable("Person").WithColumnValuePair(columnName, columnValue).NotExists();
        }
示例#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);
        }
示例#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();
        }
示例#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();
        }
示例#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);
        }
示例#9
0
        public void Evaluate_IsTrue_NothingHappens()
        {
            SetUpEvaluateTest();

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

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