Exemplo n.º 1
0
        public void RunStructTest()
        {
            Console.WriteLine("In test");
            StructEggbox eggs = new StructEggbox(12);

            AddEggs(eggs);
            Assert.AreEqual(12, eggs.Count);
        }
Exemplo n.º 2
0
        public void RunStructTestFixed()
        {
            Console.WriteLine("In test");
            Object eggs = new StructEggbox(12);

            AddEggs((RunningTotal)eggs);
            Assert.AreEqual(24, ((RunningTotal)eggs).Count);
            //((StructEggbox)eggs)._eggCount += 12; // Not allowed by compiler
            StructEggbox copied = (StructEggbox)eggs;

            copied._eggCount += 12;
            Assert.AreEqual(24, ((RunningTotal)eggs).Count);
        }
Exemplo n.º 3
0
 public void WhenAllocation()
 {
     Console.WriteLine("In test");
     {
         StructEggbox eggs = new StructEggbox(12);
         AddEggs(eggs);
         Assert.AreEqual(12, eggs.Count);
     }
     {
         ClassEggbox eggs = new ClassEggbox(12);
         AddEggs(eggs);
         Assert.AreEqual(24, eggs.Count);
     }
 }
Exemplo n.º 4
0
 public void WhenIamCalled3(bool flag)
 {
     Console.WriteLine("I am in the block");
     if (flag)
     {
         Console.WriteLine("Flag is (" + flag + ")");
         ClassEggbox eggs = new ClassEggbox(12);
         AddEggs((RunningTotal)eggs);
         Console.WriteLine("Count (" + ((RunningTotal)eggs).Count + ")");
     }
     else if (!flag)
     {
         StructEggbox eggs2 = new StructEggbox(24);
         AddEggs(eggs2);
     }
 }
Exemplo n.º 5
0
 public void WhenIamCalled(bool flag)
 {
     Console.WriteLine("I am in the block");
     if (flag)
     {
         Console.WriteLine("Flag is (" + flag + ")");
         StructEggbox[] eggs = new StructEggbox[20000];
         AddEggs(eggs[0]);
         Console.WriteLine("Count (" + eggs[0].Count + ")");
     }
     else if (!flag)
     {
         StructEggbox eggs2 = new StructEggbox(24);
         AddEggs(eggs2);
     }
 }