예제 #1
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);
        }
예제 #2
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
            }
        }