Example #1
0
        public void TestInitialCapacityDoesntImplyCount()
        {
            ArrayList4 <int> list = new ArrayList4 <int>(10);

            Assert.AreEqual(0, list.Count);
            Assert.Expect(typeof(ArgumentOutOfRangeException), delegate { list[0] = 42; });
        }
Example #2
0
        private ArrayList4 <T> RetrieveOnlyInstance <T>()
        {
            ArrayList4 <T> list = (ArrayList4 <T>)RetrieveOnlyInstance(typeof(ArrayList4 <T>));

            AssertRetrievedItem(list);
            return(list);
        }
Example #3
0
        public void TestIndexer()
        {
            ArrayList4 <string> list = RetrieveOnlyInstance <string>();

            AssertRetrievedItem(list);
            Assert.AreEqual("10", list[10]);
        }
Example #4
0
 public Bugtracker()
 {
     this._proyectos = new ArrayList4<Proyecto>();
     this._usuarios = new ArrayList4<Usuario>();
     this._roles = new ArrayList4<Rol>();
     this._plantillas = new ArrayList4<PlantillaProyecto>();
 }
		public void TestCopyTo()
		{
			ArrayList4<int> list = new ArrayList4<int>();
			MockActivator activator = MockActivator.ActivatorFor(list);
			list.CopyTo(new int[1], 0);
			Assert.AreEqual(1, activator.ReadCount());
		}
Example #6
0
 public Bugtracker()
 {
     this._proyectos  = new ArrayList4 <Proyecto>();
     this._usuarios   = new ArrayList4 <Usuario>();
     this._roles      = new ArrayList4 <Rol>();
     this._plantillas = new ArrayList4 <PlantillaProyecto>();
 }
        public void TestCopyTo()
        {
            ArrayList4 <int> list      = new ArrayList4 <int>();
            MockActivator    activator = MockActivator.ActivatorFor(list);

            list.CopyTo(new int[1], 0);
            Assert.AreEqual(1, activator.ReadCount());
        }
Example #8
0
        protected override void Store()
        {
            IList <string> list = new ArrayList4 <string>();

            for (int i = 0; i < SIZE; i++)
            {
                list.Add(i.ToString());
            }
            Store(list);
        }
Example #9
0
        public static IList <int> CreateArrayList(int count)
        {
            IList <int> list = new ArrayList4 <int>();

            for (int i = 0; i < count; i++)
            {
                list.Add(ValueForIndex(i));
            }
            return(list);
        }
Example #10
0
 public static void AssertBinarySearch <T>(ArrayList4 <T> list, params IndexOfItems <T, int>[] expectedResults)
 {
     foreach (IndexOfItems <T, int> result in expectedResults)
     {
         if (result.Expected >= 0)
         {
             Assert.AreEqual(result.Expected, list.BinarySearch(result.Value));
         }
         else
         {
             Assert.IsGreater(list.BinarySearch(result.Value), 0);
         }
     }
 }
Example #11
0
        public void TestSort()
        {
            ArrayList4 <int> list = (ArrayList4 <int>)ArrayList4Asserter.CreateArrayListAndAssertValues(100);

            list.Sort(0, list.Count, new InverseComparer());

            Assert.IsGreaterOrEqual(1, list.Count);
            for (int i = 1; i < list.Count; i++)
            {
                if (list[i - 1] < list[i])
                {
                    Assert.Fail(String.Format("Indexes ({0}, {1}). Values ({2}, {3})", i, i - 1, list[i], list[i - 1]));
                }
            }
        }
Example #12
0
        public void TestIndexOfOnEmptyList()
        {
            ArrayList4 <int> list = new ArrayList4 <int>();

            Assert.AreEqual(-1, list.IndexOf(0));
        }
Example #13
0
        static void SetupObjects()
        {
            // EMPLOYEES
            Employee fernando = new SalariedEmployee
            {
                EmployeeID = 1,
                Name = "Fernando",
                Username = "******",
                PhoneNumber = "9999",
                PayGrade = 7
            };
            Employee felipe = new HourlyPaidEmployee
            {
                EmployeeID = 2,
                Name = "Felipe",
                Username = "******",
                PhoneNumber = "8888",
                Supervisor = fernando
            };
            Employee nico = new HourlyPaidEmployee
            {
                EmployeeID = 3,
                Name = "Nico",
                Username = "******",
                PhoneNumber = "7777",
                Supervisor = felipe
            };

            // ADDRESSES
            Address ormHouse = new Address
            {
                PropertyName = "ORM House",
                PropertyNumber = 1,
                PostCode = "G4 0BA",
                Employees = new ArrayList4<Employee> { nico }           // db4o activateable collections
            };
            Address linqTower = new Address
            {
                PropertyName = "LINQ Tower",
                PropertyNumber = 9,
                PostCode = "KA1 1XX",
                Employees = new ArrayList4<Employee> { fernando, felipe }
            };

            // SET ADDRESSES FOR EMPLOYEES
            fernando.Address = linqTower;
            felipe.Address = linqTower;
            nico.Address = ormHouse;

            // PROJECTS
            Project webShop = new Project
            {
                ProjectID = 1,
                ProjectName = "Web Shop",
                Employees = new ArrayList4<Employee> { felipe, nico }
            };
            Project financeSystem = new Project
            {
                ProjectID = 2,
                ProjectName = "Finance System",
                Employees = new ArrayList4<Employee> { fernando }
            };
            Project secret = new Project
            {
                ProjectID = 3,
                ProjectName = "Secret",
                Employees = new ArrayList4<Employee> { fernando, felipe }
            };

            // SET PROJECTS FOR EMPLOYEES
            fernando.Projects = new ArrayList4<Project> { financeSystem, secret };
            felipe.Projects = new ArrayList4<Project> { webShop, secret };
            nico.Projects = new ArrayList4<Project> { webShop };

            // OBJECT GRAPH
            IList<Employee> employees = new ArrayList4<Employee> { fernando, felipe, nico };

            // STORE OBJECT GRAPH
            string dbFileName = GetDbFileName();

            using (IObjectContainer db = Db4oEmbedded.OpenFile(dbFileName))
            {
                foreach (Employee emp in employees)
                {
                    db.Store(emp);
                }
            }
        }
Example #14
0
 public Order()
 {
     _items = new ArrayList4<OrderItem>();
 }
Example #15
0
 public Order()
 {
     _items = new ArrayList4 <OrderItem>();
 }