public void Matches_Decimal10Coma3WithDecimal10Coma2_Failure()
        {
            var description = new CommandDescription(Target.Columns,
                        new CaptionFilter[]
                            {
                                new CaptionFilter(Target.Perspectives, "perspective-name")
                                , new CaptionFilter(Target.Tables, "table-name")
                                , new CaptionFilter(Target.Columns, "ccc-name")
                        });
            var actual = new NumericInfo() { Name = "decimal", Scale = 10, Precision=3 };

            var commandStub = new Mock<IDataTypeDiscoveryCommand>();
            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("decimal(10,2)");

            //Method under test
            Assert.Throws<AssertionException>(delegate { Assert.That(commandStub.Object, isConstraint); });
        }
        public void Matches_BitWithInt_Failure()
        {
            var description = new CommandDescription(Target.Columns,
                        new CaptionFilter[]
                            {
                                new CaptionFilter(Target.Perspectives, "perspective-name")
                                , new CaptionFilter(Target.Tables, "table-name")
                                , new CaptionFilter(Target.Columns, "ccc-name")
                        });
            var actual = new DataTypeInfo() { Name = "bit" };

            var commandStub = new Mock<IDataTypeDiscoveryCommand>();
            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("int");

            //Method under test
            Assert.Throws<AssertionException>(delegate { Assert.That(commandStub.Object, isConstraint); });
        }
 protected internal DataTypeDiscoveryCommand(IDbCommand command, CommandDescription description)
 {
     this.command     = command;
     this.description = description;
 }
        public void WriteTo_FailingAssertion_TextContainsColumnInfo()
        {
            var description = new CommandDescription(Target.Columns,
                        new CaptionFilter[]
                            {
                                new CaptionFilter(Target.Perspectives, "perspective-name")
                                , new CaptionFilter(Target.Tables, "table-name")
                                , new CaptionFilter(Target.Columns, "ccc-name")
                        });

            var actual = new DataTypeInfo() { Name = "bit" };

            var commandStub = new Mock<IDataTypeDiscoveryCommand>();
            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("int");

            //Method under test
            string assertionText = null;
            try
            {
                Assert.That(commandStub.Object, isConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("ccc-name").And
                                            .StringContaining("table-name").And
                                            .StringContaining("perspective-name"));
        }
        public void WriteTo_FailingAssertionForNumericTypeVersusSimpleType_TextContainsTwoTypeNamesButNotLength()
        {
            var description = new CommandDescription(Target.Columns,
                        new CaptionFilter[]
                            {
                                new CaptionFilter(Target.Perspectives, "perspective-name")
                                , new CaptionFilter(Target.Tables, "table-name")
                                , new CaptionFilter(Target.Columns, "ccc-name")
                        });

            var actual = new NumericInfo() { Name = "decimal", Scale = 10, Precision = 3 };

            var commandStub = new Mock<IDataTypeDiscoveryCommand>();
            commandStub.Setup(cmd => cmd.Execute()).Returns(actual);
            commandStub.Setup(cmd => cmd.Description).Returns(description);

            var isConstraint = new IsConstraint("varchar");

            //Method under test
            string assertionText = null;
            try
            {
                Assert.That(commandStub.Object, isConstraint);
            }
            catch (AssertionException ex)
            {
                assertionText = ex.Message;
            }

            //Test conclusion
            Console.WriteLine(assertionText);
            Assert.That(assertionText, Is.StringContaining("varchar").And
                                            .StringContaining("decimal").And
                                            .Not.StringContaining("10").And
                                            .Not.StringContaining("3")
                                            );
        }
 protected internal DataTypeDiscoveryCommand(IDbCommand command, CommandDescription description)
 {
     this.command = command;
     this.description = description;
 }