Ejemplo n.º 1
0
        public void SetDefaults()
        {
            DateTime today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            StringSet = new HashedSet();
            StringSet.Add("foo");
            StringSet.Add("bar");
            StringSet.Add("baz");

            StringDateMap = new SortedList();
            StringDateMap.Add("now", DateTime.Now);
            StringDateMap.Add("never", null); // value is persisted since NH-2199
            // according to SQL Server the big bag happened in 1753 ;)
            StringDateMap.Add("big bang", new DateTime(1753, 01, 01));
            //StringDateMap.Add( "millenium", new DateTime( 2000, 01, 01 ) );
            ArrayList list = new ArrayList();
            list.AddRange(StringSet);
            StringList = list;
            IntArray = new int[] {1, 3, 3, 7};
            FooArray = new Foo[0];
            StringArray = (String[]) list.ToArray(typeof(string));
            Customs = new ArrayList();
            Customs.Add(new String[] {"foo", "bar"});
            Customs.Add(new String[] {"A", "B"});
            Customs.Add(new String[] {"1", "2"});

            FooSet = new HashedSet();
            Components = new FooComponent[]
                {
                    new FooComponent("foo", 42, null, null),
                    new FooComponent("bar", 88, null, new FooComponent("sub", 69, null, null))
                };
            TimeArray = new DateTime[]
                {
                    new DateTime(),
                    new DateTime(),
                    new DateTime(), // H2.1 has null here, but it's illegal on .NET
                    new DateTime(0)
                };

            Count = 667;
            Name = "Bazza";
            TopComponents = new ArrayList();
            TopComponents.Add(new FooComponent("foo", 11, new DateTime[] {today, new DateTime(2123, 1, 1)}, null));
            TopComponents.Add(
                new FooComponent("bar", 22, new DateTime[] {new DateTime(2007, 2, 3), new DateTime(1945, 6, 1)}, null));
            TopComponents.Add(null);
            Bag = new ArrayList();
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("unique");

            Cached = new ListSet();

            CompositeElement ce = new CompositeElement();
            ce.Foo = "foo";
            ce.Bar = "bar";
            CompositeElement ce2 = new CompositeElement();
            ce2.Foo = "fooxxx";
            ce2.Bar = "barxxx";
            Cached.Add(ce);
            Cached.Add(ce2);
            CachedMap = new SortedList();
            CachedMap.Add(this, ce);
        }
Ejemplo n.º 2
0
        public void SetDefaults()
        {
            DateTime today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            StringSet = new HashedSet();
            StringSet.Add("foo");
            StringSet.Add("bar");
            StringSet.Add("baz");

            StringDateMap = new SortedList();
            StringDateMap.Add("now", DateTime.Now);
            StringDateMap.Add("never", null);             // value is persisted since NH-2199
            // according to SQL Server the big bag happened in 1753 ;)
            StringDateMap.Add("big bang", new DateTime(1753, 01, 01));
            //StringDateMap.Add( "millenium", new DateTime( 2000, 01, 01 ) );
            ArrayList list = new ArrayList();

            list.AddRange(StringSet);
            StringList  = list;
            IntArray    = new int[] { 1, 3, 3, 7 };
            FooArray    = new Foo[0];
            StringArray = (String[])list.ToArray(typeof(string));
            Customs     = new ArrayList();
            Customs.Add(new String[] { "foo", "bar" });
            Customs.Add(new String[] { "A", "B" });
            Customs.Add(new String[] { "1", "2" });

            FooSet     = new HashedSet();
            Components = new FooComponent[]
            {
                new FooComponent("foo", 42, null, null),
                new FooComponent("bar", 88, null, new FooComponent("sub", 69, null, null))
            };
            TimeArray = new DateTime[]
            {
                new DateTime(),
                new DateTime(),
                new DateTime(),                         // H2.1 has null here, but it's illegal on .NET
                new DateTime(0)
            };

            Count         = 667;
            Name          = "Bazza";
            TopComponents = new ArrayList();
            TopComponents.Add(new FooComponent("foo", 11, new DateTime[] { today, new DateTime(2123, 1, 1) }, null));
            TopComponents.Add(
                new FooComponent("bar", 22, new DateTime[] { new DateTime(2007, 2, 3), new DateTime(1945, 6, 1) }, null));
            TopComponents.Add(null);
            Bag = new ArrayList();
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("duplicate");
            Bag.Add("unique");

            Cached = new ListSet();

            CompositeElement ce = new CompositeElement();

            ce.Foo = "foo";
            ce.Bar = "bar";
            CompositeElement ce2 = new CompositeElement();

            ce2.Foo = "fooxxx";
            ce2.Bar = "barxxx";
            Cached.Add(ce);
            Cached.Add(ce2);
            CachedMap = new SortedList();
            CachedMap.Add(this, ce);
        }