コード例 #1
0
        public void TestCheckLockNewVersionOk()
        {
            INakedObjectAdapter testAdapter = new NakedObjectAdapter(metamodel, session, persistor, lifecycleManager, nakedObjectManager, poco, oid, loggerFactory, logger);
            var testCcVersion = new ConcurrencyCheckVersion("", DateTime.Now, new object());

            testAdapter.OptimisticLock = testCcVersion;

            testAdapter.CheckLock(testCcVersion);
        }
コード例 #2
0
        public void TestRoundTrip()
        {
            var mockMetamodelManager = new Mock <IMetamodelManager>();
            var mockLoggerFactory    = new Mock <ILoggerFactory>();

            var testCcVersion = new ConcurrencyCheckVersion("", DateTime.Now, "avalue");

            var encoded    = testCcVersion.ToEncodedStrings();
            var newVersion = new ConcurrencyCheckVersion(mockMetamodelManager.Object, mockLoggerFactory.Object, encoded);

            Assert.AreEqual(testCcVersion, newVersion);
        }
コード例 #3
0
        public void TestCheckLockDefaultFail()
        {
            INakedObjectAdapter testAdapter = new NakedObjectAdapter(metamodel, session, persistor, lifecycleManager, nakedObjectManager, poco, oid, loggerFactory, logger);
            var testCcVersionVersion        = new ConcurrencyCheckVersion("", DateTime.Now, new object());

            try {
                testAdapter.CheckLock(testCcVersionVersion);
                Assert.Fail("exception expected");
            }
            catch (ConcurrencyException) {
                // expected
            }
        }