示例#1
0
 public Game(Team _home, Team _away, Pitcher _homePitcher, Pitcher _awayPitcher, int year, int month, int day)
 {
     isPlayed           = false;
     home               = _home;
     away               = _away;
     date               = new SerializableDateTime(new DateTime(year, month, day));
     homeScoreBoard     = new ScoreBoard();
     awayScoreBoard     = new ScoreBoard();
     homeStarterPitcher = _homePitcher;
     awayStarterPitcher = _awayPitcher;
 }
示例#2
0
 public Game(Team _home, Team _away, Pitcher _homePitcher, Pitcher _awayPitcher, DateTime _date)
 {
     isPlayed           = false;
     home               = _home;
     away               = _away;
     date               = new SerializableDateTime(new DateTime(_date.Year, _date.Month, _date.Day));
     homeScoreBoard     = new ScoreBoard();
     awayScoreBoard     = new ScoreBoard();
     homeStarterPitcher = _homePitcher;
     awayStarterPitcher = _awayPitcher;
 }
示例#3
0
        public override void PopulateTestObject(int subtest)
        {
            switch (subtest)
            {
            case 0:
                // run with constructor defaults
                break;

            case 1:
                //var tm = new DateTime(2018, 12, 25, 13, 30, 15, 750, DateTimeKind.Utc);
                //var tm = new DateTime(2018, 12, 25, 13, 30, 15, 750, DateTimeKind.Local);
                var tm = new DateTime(2018, 12, 25, 13, 30, 15, 750);
                MyTime = new SerializableDateTime(tm);
                MySpan = new SerializableTimeSpan(TimeSpan.FromMilliseconds(123456789));

                /*MyTimes = new SerializableDateTime[]
                 * {
                 *  new SerializableDateTime("5/30/2018 5:30PM"),
                 *  new SerializableDateTime("5/30/2018 6:30PM")
                 * };*/
                SomeAttr      = "att";
                MyEnumProp    = MyEnum.three;
                MyEnumArray   = new MyEnum[] { MyEnum.one, MyEnum.two };
                MyBool        = true;
                MyInt         = 1;
                MyNullInt     = 42;
                MyNullIntArr  = new int?[] { 43, null, 45 };
                MyByte        = byte.MaxValue;
                MyUInt        = uint.MaxValue;
                MyLong        = long.MaxValue;
                MyDouble      = double.MaxValue;
                MyIntArray    = new int[] { 3, 4, 5 };
                MyJagIntArray = new int[][]
                {
                    new int[] { 6, 7, 8 },
                    new int[] { 9, 10 },
                };
                MyJagIntArray2 = new int[][][]
                {
                    new int[][] { new int[] { 11, 22 }, new int[] { 33, 44 } },
                    new int[][] { new int[] { 55, 66 }, new int[] { 77, 88 } },
                };
                MyJagEnumArray = new MyEnum[][]
                {
                    new MyEnum[] { MyEnum.one, MyEnum.two },
                    new MyEnum[] { MyEnum.three }
                };
                MyStrList = new List <string>();
                MyStrList.Add("List0");
                MyStrList.Add("List1");
                MySubClass.Populate(-1);
                MySubClassArray = new SubTestClass[3];
                for (int i = 0; i < MySubClassArray.Length - 1; ++i)
                {
                    MySubClassArray[i] = new SubTestClass();
                    MySubClassArray[i].Populate(i);
                }
                MyIntDict.Add("first", 55);
                MyIntDict.Add("second", 65);
                MyIntDictTyped.Add("third", 75);
                MyIntDictTyped.Add("fourth", 85);
                MyIntDictArr = new SerializableDictionary <string, int> [2];
                for (int i = 0; i < MyIntDictArr.Length; ++i)
                {
                    MyIntDictArr[i] = new SerializableDictionary <string, int>();
                    MyIntDictArr[i].Add("item1-" + i.ToString(), i * 9);
                    MyIntDictArr[i].Add("item2-" + i.ToString(), i * 19);
                }
                var sub = new SubTestClass();
                sub.Populate(11);
                MySubClassDict.Add("subclass", sub);
                MyEnumArrDict = new SerializableDictionary <string, MyEnum[]>();
                MyEnumArrDict.Add("EnumKey", new MyEnum[] { MyEnum.three, MyEnum.two, MyEnum.one });
                // good lord
                MyIntDictDict = new SerializableDictionary <string, SerializableDictionary <string, int> >();
                MyIntDictDict.Add("really", MyIntDict);
                // stop, please
                MyIntDictArrDict = new SerializableDictionary <string, SerializableDictionary <string, int>[]>();
                MyIntDictArrDict.Add("yes", MyIntDictArr);
                // and now for something completely different
                Hues = new string[] { "red", "green", "blue" };
                break;

            default:
                break;
            }
        }