public void VerifyJetCommitIdEqualityToNullIsFalse()
        {
            var sigX = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Komputer",
            };

            var x = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigX,
                commitId = 123,
            });

            Assert.IsFalse(x == null);

            Assert.AreEqual(1, x.CompareTo(null));

            var commitZero = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigX,
                commitId = 0,
            });

            Assert.AreEqual(0, commitZero.CompareTo(null));
        }
        public void VerifyJetCommitIdEquality()
        {
            var sigX = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Komputer",
            };
            var sigY = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = sigX.logtimeCreate,
                szComputerName = "Komputer",
            };

            var x = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigX,
                commitId = 123,
            });
            var y = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigY,
                commitId = 123,
            });

            TestEquals(x, y);
            Assert.IsTrue(x == y);
            Assert.IsFalse(x != y);
        }
        public void VerifyJetCommitIdThrowsExceptionWithInequalSignatures()
        {
            var sigX = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Komputer",
            };
            var sigDifferent = new NATIVE_SIGNATURE()
            {
                ulRandom       = 7777,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Different!",
            };

            var x = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigX,
                commitId = 789,
            });
            var y = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigDifferent,
                commitId = 789,
            });

            Assert.AreNotEqual(0, x.CompareTo(y));
        }
        public void VerifyJetCommitIdInequality()
        {
            var sigX = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Komputer",
            };

            // Note that there isn't a case that has a different log signature; that's because
            // JET_COMMIT_ID.CompareTo() throws an exception if the log signature is different.
            //
            // None of these objects are equal, most differ in only one member from the
            // first object. We will compare them all against each other.
            var commitIds = new[]
            {
                new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
                {
                    signLog  = sigX,
                    commitId = 567,
                }),
                new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
                {
                    signLog  = sigX,
                    commitId = 9999, // Different
                }),
            };

            VerifyAll(commitIds);
        }
Esempio n. 5
0
        public void CreateJetSignatureFromNativeSignature()
        {
            var t = new DateTime(1999, 12, 31, 23, 59, 59, DateTimeKind.Utc);

            var native = new NATIVE_SIGNATURE
            {
                ulRandom = 9,
                logtimeCreate = new JET_LOGTIME(t),
            };

            native.szComputerName = "COMPUTER";

            var expected = new JET_SIGNATURE(9, t, "COMPUTER");
            var actual = new JET_SIGNATURE(native);
            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
        public void CreateJetSignatureFromNativeSignature()
        {
            var t = new DateTime(1999, 12, 31, 23, 59, 59, DateTimeKind.Utc);

            var native = new NATIVE_SIGNATURE
            {
                ulRandom      = 9,
                logtimeCreate = new JET_LOGTIME(t),
            };

            native.szComputerName = "COMPUTER";

            var expected = new JET_SIGNATURE(9, t, "COMPUTER");
            var actual   = new JET_SIGNATURE(native);

            Assert.AreEqual(expected, actual);
        }
        public void VerifyJetCommitIdEqualityToWrongTypeIsFalse()
        {
            var sigX = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Komputer",
            };

            var x = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigX,
                commitId = 123,
            });

            Assert.IsFalse(x.Equals(sigX));
        }
        public void Setup()
        {
            var sigX = new NATIVE_SIGNATURE()
            {
                ulRandom       = 1,
                logtimeCreate  = Any.Logtime,
                szComputerName = "Komputer",
            };

            this.managedOriginal = new JET_COMMIT_ID(new NATIVE_COMMIT_ID()
            {
                signLog  = sigX,
                commitId = 123,
            });

            this.native  = this.managedOriginal.GetNativeCommitId();
            this.managed = new JET_COMMIT_ID(this.native);
        }
Esempio n. 9
0
 public static extern int JetGetInstanceMiscInfo(IntPtr instance, ref NATIVE_SIGNATURE pvResult, uint cbMax, uint infoLevel);
Esempio n. 10
0
 public static extern int JetGetInstanceMiscInfo(IntPtr instance, ref NATIVE_SIGNATURE pvResult, uint cbMax, uint infoLevel);