public void Combine_Two()
        {
            var column1 = ColumnDefinitionObjectMother.CreateColumn("1");
            var column2 = ColumnDefinitionObjectMother.CreateColumn("2");
            var column3 = ColumnDefinitionObjectMother.CreateColumn("3");
            var column4 = ColumnDefinitionObjectMother.CreateColumn("4");

            var one = new ColumnValueTable(
                new[] { column1, column2 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "a", "b" }),
                new ColumnValueTable.Row(new[] { "c", "d" })
            });
            var two = new ColumnValueTable(
                new[] { column3, column4 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "e", "f" }),
                new ColumnValueTable.Row(new[] { "g", "h" })
            });

            var result = ColumnValueTable.Combine(one, two);

            var expected = new ColumnValueTable(
                new[] { column1, column2, column3, column4 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "a", "b", "e", "f" }),
                new ColumnValueTable.Row(new[] { "c", "d", "g", "h" })
            });

            ColumnValueTableTestHelper.CheckTable(expected, result);
        }
        public void SplitValuesForComparison()
        {
            var dateTime1 = new DateTime(2011, 7, 18);
            var dateTime2 = new DateTime(2012, 8, 19);

            var row1 = new ColumnValueTable.Row(new object[] { "2011" });
            var row2 = new ColumnValueTable.Row(new object[] { "2012" });
            var row3 = new ColumnValueTable.Row(new object[] { "7" });
            var row4 = new ColumnValueTable.Row(new object[] { "8" });
            var row5 = new ColumnValueTable.Row(new object[] { "18" });
            var row6 = new ColumnValueTable.Row(new object[] { "19" });

            _property1Stub
            .Stub(stub => stub.SplitValuesForComparison(Arg <IEnumerable <object> > .List.Equal(new object[] { 2011, 2012 })))
            .Return(new ColumnValueTable(new[] { _columnDefinition1 }, new[] { row1, row2 }));
            _property2Stub
            .Stub(stub => stub.SplitValuesForComparison(Arg <IEnumerable <object> > .List.Equal(new object[] { 7, 8 })))
            .Return(new ColumnValueTable(new[] { _columnDefinition2 }, new[] { row3, row4 }));
            _property3Stub
            .Stub(stub => stub.SplitValuesForComparison(Arg <IEnumerable <object> > .List.Equal(new object[] { 18, 19 })))
            .Return(new ColumnValueTable(new[] { _columnDefinition3 }, new[] { row5, row6 }));

            var result = _compoundStoragePropertyDefinition.SplitValuesForComparison(new object[] { dateTime1, dateTime2 });

            var expectedTable = new ColumnValueTable(
                new[] { _columnDefinition1, _columnDefinition2, _columnDefinition3 },
                new[]
            {
                new ColumnValueTable.Row(new object[] { "2011", "7", "18" }),
                new ColumnValueTable.Row(new object[] { "2012", "8", "19" })
            });

            ColumnValueTableTestHelper.CheckTable(expectedTable, result);
        }
        public void SplitValuesForComparison()
        {
            var row1             = new ColumnValueTable.Row(new[] { "1" });
            var row2             = new ColumnValueTable.Row(new[] { "2" });
            var columnValueTable = new ColumnValueTable(new[] { _columnDefinition }, new[] { row1, row2 });

            _serializedIDPropertyStub
            .Stub(stub => stub.SplitValuesForComparison(Arg <IEnumerable <object> > .List.Equal(
                                                            new[] { DomainObjectIDs.Order1.ToString(), DomainObjectIDs.Order3.ToString() })))
            .Return(columnValueTable);

            var result = _serializedObjectIDStoragePropertyDefinition.SplitValuesForComparison(new object[] { DomainObjectIDs.Order1, DomainObjectIDs.Order3 });

            ColumnValueTableTestHelper.CheckTable(columnValueTable, result);
        }
        public void SplitValuesForComparison_NullValue()
        {
            var row1             = new ColumnValueTable.Row(new[] { "1" });
            var row2             = new ColumnValueTable.Row(new[] { "2" });
            var columnValueTable = new ColumnValueTable(new[] { _columnDefinition }, new[] { row1, row2 });

            // Bug in Rhino Mocks: List.Equal constraint cannot handle nulls within the sequence
            _serializedIDPropertyStub
            .Stub(stub => stub.SplitValuesForComparison(
                      Arg <IEnumerable <object> > .Matches(seq => seq.SequenceEqual(new[] { null, DomainObjectIDs.Order3.ToString() }))))
            .Return(columnValueTable);

            var result = _serializedObjectIDStoragePropertyDefinition.SplitValuesForComparison(new object[] { null, DomainObjectIDs.Order3 });

            ColumnValueTableTestHelper.CheckTable(columnValueTable, result);
        }
示例#5
0
        public void SplitValuesForComparison_NullValue()
        {
            var value2 = new object();

            var result = _storagePropertyDefinition.SplitValuesForComparison(new[] { null, value2 });

            var expectedTable = new ColumnValueTable(
                new[] { _innerColumnDefinition },
                new[]
            {
                new ColumnValueTable.Row(new object[] { null }),
                new ColumnValueTable.Row(new[] { value2 })
            });

            ColumnValueTableTestHelper.CheckTable(expectedTable, result);
        }
        public void Combine_Many()
        {
            var column1 = ColumnDefinitionObjectMother.CreateColumn("1");
            var column2 = ColumnDefinitionObjectMother.CreateColumn("2");
            var column3 = ColumnDefinitionObjectMother.CreateColumn("3");
            var column4 = ColumnDefinitionObjectMother.CreateColumn("4");
            var column5 = ColumnDefinitionObjectMother.CreateColumn("5");
            var column6 = ColumnDefinitionObjectMother.CreateColumn("6");

            var one = new ColumnValueTable(
                new[] { column1, column2 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "a", "b" }),
                new ColumnValueTable.Row(new[] { "c", "d" })
            });
            var two = new ColumnValueTable(
                new[] { column3, column4 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "e", "f" }),
                new ColumnValueTable.Row(new[] { "g", "h" })
            });

            var three = new ColumnValueTable(
                new[] { column5, column6 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "i", "j" }),
                new ColumnValueTable.Row(new[] { "k", "l" })
            });

            var result = ColumnValueTable.Combine(new[] { one, two, three });

            var expected = new ColumnValueTable(
                new[] { column1, column2, column3, column4, column5, column6 },
                new[]
            {
                new ColumnValueTable.Row(new[] { "a", "b", "e", "f", "i", "j" }),
                new ColumnValueTable.Row(new[] { "c", "d", "g", "h", "k", "l" })
            });

            ColumnValueTableTestHelper.CheckTable(expected, result);
        }