Ejemplo n.º 1
0
        public void Array_Create_BadDateTimeKind()
        {
            // Testing the detection of bad DateTime kind as an array is being created.

            var columns = new List <Item_Array.ArrayColumn>()
            {
                new Item_Array.ArrayColumn(typeof(DateTime), "DateTimeCol")
                {
                    Label       = "Label for DateTime",
                    Description = "Desc for DateTime"
                },
                new Item_Array.ArrayColumn(typeof(double), "DoubleCol")
                {
                    Label       = "Label for double",
                    Description = "Desc for double"
                }
            };

            var arrayItem = new Item_Array(columns);

            // This does not have UTC as the kind
            var dateTime1 = ParseDateTimeInUtc("2019-01-11T00:11:19Z").ToLocalTime();

            try
            {
                arrayItem.Add(dateTime1, -4.2);
                Assert.Fail("Expected an exception");
            }
            catch (XNeut.DateTimeException) { }
        }
Ejemplo n.º 2
0
        public void Array_Create_NoColumns()
        {
            // Testing the creation of an array without columns

            var arrayItem = new Item_Array(new List <Item_Array.ArrayColumn>());

            // Adding 3 empty rows
            arrayItem.Add();
            arrayItem.Add();
            arrayItem.Add();

            var arrayItemIn = (Item_Array)SerialiseAndReadResultObj(arrayItem, XNeut.Helper.TypeUri_Complex);

            Assert.AreEqual(0, arrayItemIn.Columns.Count);
            Assert.AreEqual(3, arrayItemIn.RowCount);
        }