예제 #1
0
        public void TestGetLast()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5L, atom);

            Assert.AreEqual(0L, pair.Last);
        }
예제 #2
0
        public void TestGetAtom()
        {
            InvPair pair = new InvPair();

            Assert.IsNull(pair.Atom);
            pair.Atom = builder.NewAtom(ChemicalElement.C);
            Assert.IsNotNull(pair.Atom);
        }
예제 #3
0
        public void TestToString()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5L, atom);

            Assert.IsNotNull(pair.ToString());
            Assert.IsTrue(pair.ToString().Length > 0);
        }
예제 #4
0
        public void TestSetAtomIAtom()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair();

            Assert.AreNotSame(atom, pair.Atom);
            pair.Atom = atom;
            Assert.AreEqual(atom, pair.Atom);
        }
예제 #5
0
        public void TestEqualsObject()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5L, atom);

            Assert.AreEqual(pair, pair);
            Assert.AreNotSame("NotSame", pair);
            Assert.AreNotSame(new InvPair(), pair);
        }
예제 #6
0
        public void TestInvPairLongIAtom()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5L, atom);

            Assert.IsNotNull(pair);
            Assert.AreEqual(5L, pair.Curr);
            Assert.AreEqual(atom, pair.Atom);
        }
예제 #7
0
        public void TestSetCurrLong()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5L, atom);

            Assert.AreEqual(5L, pair.Curr);
            pair.Curr = 4L;
            Assert.AreEqual(4L, pair.Curr);
        }
예제 #8
0
        public void TestCommit()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5L, atom);

            pair.Commit();
            Assert.IsNotNull(atom.GetProperty <long>(InvPair.CanonicalLabelPropertyKey));
            Assert.AreEqual(5, ((long)atom.GetProperty <long>(InvPair.CanonicalLabelPropertyKey)));
        }
예제 #9
0
        public void TestGetPrime()
        {
            var     atom = builder.NewAtom(ChemicalElement.C);
            InvPair pair = new InvPair(5, atom);

            pair.SetPrime();
            int prime = pair.Prime;

            pair.SetPrime();
            Assert.AreEqual(prime, pair.Prime, "The prime should not change when curr is not changed");
            pair.Curr = 61;
            pair.SetPrime();
            Assert.AreNotSame(prime, pair.Prime);
        }
예제 #10
0
        public void TestSetPrime()
        {
            InvPair pair = new InvPair();

            try
            {
                pair.SetPrime();
                Assert.Fail("should have failed with an ArrayIndexOutOfBounds exception");
            }
            catch (Exception)
            {
                // OK, is apparently expected to happen
            }
        }
예제 #11
0
        public void TestInvPair()
        {
            InvPair pair = new InvPair();

            Assert.IsNotNull(pair);
        }