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); }
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); }
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 } }