Ejemplo n.º 1
0
        public void MandatoryColumnsAreReturnedForCollection()
        {
            //Arrange
            var definer = _om.Collection.DefineTable("LocalTable")
                          .CompareKey("CompareKey")
                          .CompareKey("CompareKey2")
                          .IsReference("ParentId", "ReferencingTable", "OtherId")
                          .IsRequired("Required");

            var diffs = MakeDifferences();

            //Act
            var result = MandatoryColumnFinder.Find(_om.Collection, diffs);

            //Assert
            var output = new Output();
            var report = result.AsReport(rep => rep.RemoveBufferLimit()
                                         .AddColumn(t => t.TableDefinition.TableName, cc => cc.Heading("Table"))
                                         .AddChild(t => t.Columns, crep => crep.RemoveBufferLimit()
                                                   .AddColumn(c => c, cc => cc.Heading("Column")))
                                         );

            output.FormatTable(report);
            output.Report.Verify();
        }
Ejemplo n.º 2
0
        public void ExcludedPrimaryKeyColumnsColumnsAreNotReturnedForCollection()
        {
            //Arrange
            var definer = _om.Collection.DefineTable("LocalTable")
                          .PrimaryKey("CompareKey")
                          .PrimaryKey("CompareKey2")
                          .IsReference("ParentId", "ReferencingTable", "OtherId")
                          .IsRequired("Required")
                          .IsRequired("Required2")
                          .Exclude("CompareKey");

            var diffs = MakeDifferences();

            //Act
            var result = MandatoryColumnFinder.Find(_om.Collection, diffs);

            //Assert
            result.Any(r => r.Columns.Contains("CompareKey")).Should().BeFalse();
        }