Beispiel #1
0
        public void IncRowVersion_HappyDays_SendsCorrectSqlToProvider()
        {
            var factory  = GetProviderFactory();
            var provider = new StubSqlProvider();

            using (mocks.Record())
            {
                factory.CreateProvider("somestring");
                LastCall.Return(provider).IgnoreArguments();
            }

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

            Assert.AreEqual("UPDATE Person SET Version = Version + 1 WHERE IdPerson = 1", provider.GetExecutedQuery(0));
        }
Beispiel #2
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);
        }