Exemple #1
0
            private static IEnumerable <TestCaseData> GetColumnTestCases()
            {
                var array2x3 = Array2D <int> .FromSystem2DArray(
                    new int[, ] {
                    { 4, 8 },
                    { 3, 9 },
                    { 7, 2 }
                });

                var firstColumn = new RefColumn <int, Array2D <int> >(new Array2D <int>(3, 1), 0);

                firstColumn[0] = 4;
                firstColumn[1] = 3;
                firstColumn[2] = 7;

                var lastColumn = new RefColumn <int, Array2D <int> >(new Array2D <int>(3, 1), 0);

                lastColumn[0] = 8;
                lastColumn[1] = 9;
                lastColumn[2] = 2;

                yield return(new TestCaseData(array2x3, 0, firstColumn));

                yield return(new TestCaseData(array2x3, 1, lastColumn));
            }
            private static IEnumerable <TestCaseData> GetColumnTestCases()
            {
                var matrix = RefMatrix4x4.FromSystem2DArray(
                    new float[, ] {
                    { 1, 2, 3, 4 },
                    { 9, 8, 7, 6 },
                    { 3, 6, 12, 24 },
                    { 5, 25, 125, 625 }
                });

                var firstColumn = new RefColumn <float, RefMatrix4x4>(
                    RefMatrix4x4.FromSystem2DArray(
                        new float[, ] {
                    { 1, 0, 0, 0 },
                    { 9, 0, 0, 0 },
                    { 3, 0, 0, 0 },
                    { 5, 0, 0, 0 }
                }), 0);

                var lastColumn = new RefColumn <float, RefMatrix4x4>(
                    RefMatrix4x4.FromSystem2DArray(
                        new float[, ] {
                    { 4, 0, 0, 0 },
                    { 6, 0, 0, 0 },
                    { 24, 0, 0, 0 },
                    { 625, 0, 0, 0 }
                }), 0);

                yield return(new TestCaseData(matrix, 0, firstColumn));

                yield return(new TestCaseData(matrix, 3, lastColumn));
            }
            private static IEnumerable <TestCaseData> GetColumnTestCases()
            {
                var list2x3 = List2D <int> .FromSystem2DArray(
                    new int[, ] {
                    { 4, 8 },
                    { 3, 9 },
                    { 7, 2 }
                });

                list2x3.IncreaseCapacity(list2x3.Boundaries);

                var firstColumn = new RefColumn <int, List2D <int> >(
                    CreateList2DWithBounds <int>(3, 1), 0);

                firstColumn[0] = 4;
                firstColumn[1] = 3;
                firstColumn[2] = 7;

                var lastColumn = new RefColumn <int, List2D <int> >(
                    CreateList2DWithBounds <int>(3, 1), 0);

                lastColumn[0] = 8;
                lastColumn[1] = 9;
                lastColumn[2] = 2;

                yield return(new TestCaseData(list2x3, 0, firstColumn));

                yield return(new TestCaseData(list2x3, 1, lastColumn));
            }
 public static void TestFillWith <T, TRefRectangularCollection, TEnumerable>(
     RefColumn <T, TRefRectangularCollection> actual, T value, TEnumerable expected)
     where TRefRectangularCollection : IRefRectangularCollection <T>
     where TEnumerable : IEnumerable <T>
 {
     actual.FillWith(value);
     CollectionAssert.AreEqual(expected, actual);
 }
 public static void TestReverse <T, TRefRectangularCollection, TEnumerable>(
     RefColumn <T, TRefRectangularCollection> actual, TEnumerable expected)
     where TRefRectangularCollection : IRefRectangularCollection <T>
     where TEnumerable : IEnumerable <T>
 {
     actual.Reverse();
     CollectionAssert.AreEqual(expected, actual);
 }
        internal CompanyTable(CompanyDatabase database) : base()
        {
            Database = database;

            Id         = AddColumn(nameof(Id), database.BuildColumn <long>(nameof(Company), nameof(Id), 99));
            JoinPolicy = AddColumn(nameof(JoinPolicy), database.BuildColumn <byte>(nameof(Company), nameof(JoinPolicy), (byte)SecurityPolicy.Open));
            Owner      = AddColumn(nameof(Owner), new RefColumn(nameof(CompanyDatabase.Employee)));
            Members    = AddColumn(nameof(Members), new RefListColumn(nameof(CompanyDatabase.Employee)));
            Teams      = AddColumn(nameof(Teams), new RefListColumn(nameof(CompanyDatabase.Team)));
        }
Exemple #7
0
        // </RefListColumnMember>
        // </ColumnMemberList>

        internal TeamTable(CompanyDatabase database) : base()
        {
            Database = database;

            // <ColumnConstructorList>

            // <SimpleColumnConstructor>
            Id = AddColumn(nameof(Id), database.BuildColumn <long>(nameof(Team), nameof(Id), 99));
            // </SimpleColumnConstructor>

            // <EnumColumnConstructor>
            JoinPolicy = AddColumn(nameof(JoinPolicy), database.BuildColumn <byte>(nameof(Team), nameof(JoinPolicy), (byte)SecurityPolicy.Open));
            // </EnumColumnConstructor>

            // <RefColumnConstructor>
            Owner = AddColumn(nameof(Owner), new RefColumn(nameof(CompanyDatabase.Employee)));
            // </RefColumnConstructor>

            // <RefListColumnConstructor>
            Members = AddColumn(nameof(Members), new RefListColumn(nameof(CompanyDatabase.Employee)));
            // </RefListColumnConstructor>

            // </ColumnConstructorList>
        }
Exemple #8
0
 public static void IsValidIndexReturnsFalseOnInvalidIndexArguments <T>(
     RefColumn <T, Array2D <T> > indexable, int index)
 => RefIndexableTests.IsValidIndexReturnsFalseOnInvalidIndexArguments
 <T, RefColumn <T, Array2D <T> > >(indexable, index);
Exemple #9
0
 public static void TestFillWith <T, TEnumerable>(
     RefColumn <T, Array2D <T> > actual, T value, TEnumerable expected)
     where TEnumerable : IEnumerable <T>
 => RefColumnTests.TestFillWith(actual, value, expected);
Exemple #10
0
 public static void TestIndexer <T>(
     RefColumn <T, Array2D <T> > indexable, int index, T expected)
 => RefIndexableTests.TestIndexer(indexable, index, expected);
Exemple #11
0
 public static void IndexerThrowsExceptionIfIndexIsOutOfBounds <T>(
     RefColumn <T, Array2D <T> > column, int index)
 => RefColumnTests.IndexerThrowsExceptionIfIndexIsOutOfBounds(column, index);
Exemple #12
0
 public static void TestReverse <T, TEnumerable>(
     RefColumn <T, Array2D <T> > actual, TEnumerable expected)
     where TEnumerable : IEnumerable <T>
 => RefColumnTests.TestReverse(actual, expected);
Exemple #13
0
 public static void GetColumnTest <T>(
     Array2D <T> array, int index, RefColumn <T, Array2D <T> > expected)
 => CollectionAssert.AreEqual(expected, array.GetColumn(index));
Exemple #14
0
 public static void CountEqualsCollectionLength1 <T>(
     Array2D <T> collection, RefColumn <T, Array2D <T> > column)
 => RefColumnTests.CountEqualsCollectionLength1(collection, column);
 public static void TestEquality <T, TEnumerable>(
     RefColumn <T, List2D <T> > actual, TEnumerable expected)
     where TEnumerable : IEnumerable <T>
 => RefColumnTests.TestEquality(actual, expected);
 public static void GetColumnTest <T>(
     List2D <T> list, int index, RefColumn <T, List2D <T> > expected)
 => CollectionAssert.AreEqual(expected, list.GetColumn(index));
 public static void GetColumnTest(
     RefMatrix4x4 matrix,
     int index,
     RefColumn <float, RefMatrix4x4> expected)
 => CollectionAssert.AreEqual(
     expected, matrix.GetColumn <float, RefMatrix4x4>(index));
 public static void IndexerThrowsExceptionIfIndexIsOutOfBounds
 <T, TRefRectangularCollection>(
     RefColumn <T, TRefRectangularCollection> column, int index)
     where TRefRectangularCollection : IRefRectangularCollection <T>
 => Assert.Throws <IndexOutOfRangeException>(() => { T value = column[index]; });
 public static void CountEqualsCollectionLength1 <T, TRefRectangularCollection>(
     TRefRectangularCollection collection,
     RefColumn <T, TRefRectangularCollection> column)
     where TRefRectangularCollection : IRefRectangularCollection <T>
 => Assert.AreEqual(collection.Boundaries.Length1, column.Count);