public void FailedTest() { Site target = new Site(); bool expected = false; bool actual; actual = target.Failed(); Assert.AreEqual(expected, actual); target.Fail(1); actual = target.Failed(); expected = true; Assert.AreEqual(expected, actual); actual = target.Failed(); expected = true; Assert.AreEqual(expected, actual); }
public void GetFirstFailureTest() { Site target = new Site(1); int beginning = 0; int expected = 1; int? actual; actual = target.GetFirstFailureSinceAccess(beginning); Assert.IsNull(actual); target.Fail(1); target.Fail(4); target.Fail(2); target.Fail(10); target.Fail(7); actual = target.GetFirstFailureSinceAccess(beginning); Assert.AreEqual(expected, actual); expected = 4; beginning = 3; actual = target.GetFirstFailureSinceAccess(beginning); Assert.AreEqual(expected, actual); expected = 10; beginning = 11; actual = target.GetFirstFailureSinceAccess(beginning); Assert.IsNull(actual); }
public void RecoverTest() { Site target = new Site(4); target.Fail(0); target.Recover(); Assert.AreEqual(Enumerations.SiteStatus.Active, target.Status); for (int i = 2; i <= 20; i += 2) { LockManagerTableEntry entry = target.GetCopyOfEntry(i); Assert.AreEqual(1, entry.ActiveLocks.Count); Assert.AreEqual(int.MinValue, entry.ActiveLocks[0].TransactionId); } }