Beispiel #1
0
        public void OneMonth()
        {
            var start = new DateTime(2013, 1, 1);
            var end   = new DateTime(2013, 1, 31);
            var keys  = new int[] { 101, 102, 103 };
            var sut   = new DailyTxn1Key <TestStruct1>();

            sut.AllocateMemory(keys, start, end);

            sut.Data.MustNotBeNull("sut.Data");
            sut.Data.Length.MustBe(1, "years count");
            sut.Data[0].Length.MustBe(1, "months in year[0]");
            sut.Data[0][0].Length.MustBe(31, "days in month[0] year[0]");

            for (int i = 0; i < sut.Data[0][0].Length; i++)
            {
                sut.Data[0][0][i].Length.MustBe(keys.Length,
                                                $"keys in day[{i}] month[0] year[0]");

                for (int j = 0; j < keys.Length; j++)
                {
                    sut.Data[0][0][i][j].MustBe(null,
                                                $"key[{j}] of day[{i}] month[0] year[0]");
                }
            }
        }
Beispiel #2
0
        public void Contructor()
        {
            var start = new DateTime(2013, 7, 1);
            var end   = new DateTime(2014, 12, 31);
            var keys = new int[] { 101, 102, 103 };
            var sut = new DailyTxn1Key<TestStruct1>();

            sut.AllocateMemory(keys, start, end);

            sut.Data.MustNotBeNull("sut.Data");
            sut.Data.Length.MustBe(2, "years count");

            sut.Data[0].Length.MustBe(6, "months in year[0]");
            sut.Data[1].Length.MustBe(12, "months in year[1]");
        }
Beispiel #3
0
        public void Contructor()
        {
            var start = new DateTime(2013, 7, 1);
            var end   = new DateTime(2014, 12, 31);
            var keys  = new int[] { 101, 102, 103 };
            var sut   = new DailyTxn1Key <TestStruct1>();

            sut.AllocateMemory(keys, start, end);

            sut.Data.MustNotBeNull("sut.Data");
            sut.Data.Length.MustBe(2, "years count");

            sut.Data[0].Length.MustBe(6, "months in year[0]");
            sut.Data[1].Length.MustBe(12, "months in year[1]");
        }
Beispiel #4
0
        public void Case1()
        {
            var start = new DateTime(2013, 1, 1);
            var keys  = new int[] { 101, 102, 103 };
            var sut   = new DailyTxn1Key<TestStruct1>();

            sut.AllocateMemory(keys, start);

            TestStruct1 s;
            s.Field1 = 123;
            s.Field2 = 456;

            sut[2013, 10, 15, 101] = s;

            sut[2013, 10, 15, 101].Field1.MustBe(123);

            Assert.Throws(typeof(IndexOutOfRangeException), () =>
            {
                sut[2013, 10, 15, 102].Field2.MustBe(888);
            });
        }
Beispiel #5
0
        public void Case1()
        {
            var start = new DateTime(2013, 1, 1);
            var keys  = new int[] { 101, 102, 103 };
            var sut   = new DailyTxn1Key <TestStruct1>();

            sut.AllocateMemory(keys, start);

            TestStruct1 s;

            s.Field1 = 123;
            s.Field2 = 456;

            sut[2013, 10, 15, 101] = s;

            sut[2013, 10, 15, 101].Field1.MustBe(123);

            Assert.Throws(typeof(IndexOutOfRangeException), () =>
            {
                sut[2013, 10, 15, 102].Field2.MustBe(888);
            });
        }
Beispiel #6
0
        public void OneMonth()
        {
            var start = new DateTime(2013, 1, 1);
            var end   = new DateTime(2013, 1, 31);
            var keys  = new int[] { 101, 102, 103 };
            var sut   = new DailyTxn1Key<TestStruct1>();

            sut.AllocateMemory(keys, start, end);

            sut.Data.MustNotBeNull("sut.Data");
            sut.Data.Length.MustBe(1, "years count");
            sut.Data[0].Length.MustBe(1, "months in year[0]");
            sut.Data[0][0].Length.MustBe(31, "days in month[0] year[0]");

            for (int i = 0; i < sut.Data[0][0].Length; i++)
            {
                sut.Data[0][0][i].Length.MustBe(keys.Length, 
                    $"keys in day[{i}] month[0] year[0]");

                for (int j = 0; j < keys.Length; j++)
                    sut.Data[0][0][i][j].MustBe(null, 
                        $"key[{j}] of day[{i}] month[0] year[0]");
            }
        }