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

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

            Assert.IsNull(pair.Atom);
            pair.Atom = builder.NewAtom(ChemicalElement.C);
            Assert.IsNotNull(pair.Atom);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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)));
        }
Esempio n. 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);
        }
Esempio n. 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
            }
        }
Esempio n. 11
0
        public void TestInvPair()
        {
            InvPair pair = new InvPair();

            Assert.IsNotNull(pair);
        }