public void Matches_Int_Success() { var actual = new NumericInfo() { Name = "int" }; var commandStub = new Mock <IDataTypeDiscoveryCommand>(); commandStub.Setup(cmd => cmd.Execute()).Returns(actual); var isConstraint = new IsConstraint("int"); //Method under test Assert.That(commandStub.Object, isConstraint); }
public void Matches_Decimal10Coma3_Success() { var actual = new NumericInfo() { Name = "decimal", Precision = 10, Scale = 3 }; var commandStub = new Mock <IDataTypeDiscoveryCommand>(); commandStub.Setup(cmd => cmd.Execute()).Returns(actual); var isConstraint = new IsConstraint("decimal(10,3)"); //Method under test Assert.That(commandStub.Object, isConstraint); }
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") ); }
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); }); }