public void CallingInSchemaSetsForeignTableSchemaName()
        {
            var foreignKeyMock = new Mock<ForeignKeyDefinition>();

            var expressionMock = new Mock<DeleteForeignKeyExpression>();
            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);
            ((IInSchemaSyntax)builder).InSchema("Bacon");

            foreignKeyMock.VerifySet(f => f.ForeignTableSchema = "Bacon");
            expressionMock.VerifyGet(e => e.ForeignKey);
        }
        public void CallingToTableSetsPrimaryTableName()
        {
            var foreignKeyMock = new Mock<ForeignKeyDefinition>();

            var expressionMock = new Mock<DeleteForeignKeyExpression>();
            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);
            builder.ToTable("Bacon");

            foreignKeyMock.VerifySet(f => f.PrimaryTable = "Bacon");
            expressionMock.VerifyGet(e => e.ForeignKey);
        }
        public void CallingFromTableSetsForeignTableName()
        {
            var foreignKeyMock = new Mock<ForeignKeyDefinition>();
            foreignKeyMock.SetupSet(f => f.ForeignTable = "Bacon").AtMostOnce();

            var expressionMock = new Mock<DeleteForeignKeyExpression>();
            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object).AtMostOnce();

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);
            builder.FromTable("Bacon");

            foreignKeyMock.VerifyAll();
            expressionMock.VerifyAll();
        }
        public void CallingInSchemaSetsForeignTableSchemaName()
        {
            var foreignKeyMock = new Mock <ForeignKeyDefinition>();

            var expressionMock = new Mock <DeleteForeignKeyExpression>();

            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);

            ((IInSchemaSyntax)builder).InSchema("Bacon");

            foreignKeyMock.VerifySet(f => f.ForeignTableSchema = "Bacon");
            expressionMock.VerifyGet(e => e.ForeignKey);
        }
        public void CallingToTableSetsPrimaryTableName()
        {
            var foreignKeyMock = new Mock <ForeignKeyDefinition>();

            var expressionMock = new Mock <DeleteForeignKeyExpression>();

            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);

            builder.ToTable("Bacon");

            foreignKeyMock.VerifySet(f => f.PrimaryTable = "Bacon");
            expressionMock.VerifyGet(e => e.ForeignKey);
        }
        public void CallingForeignColumnAddsColumnNameToForeignColumnCollection()
        {
            var collectionMock = new Mock<IList<string>>();

            var foreignKeyMock = new Mock<ForeignKeyDefinition>();
            foreignKeyMock.SetupGet(f => f.ForeignColumns).Returns(collectionMock.Object);

            var expressionMock = new Mock<DeleteForeignKeyExpression>();
            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);
            builder.ForeignColumn("BaconId");

            collectionMock.Verify(x => x.Add("BaconId"));
            foreignKeyMock.VerifyGet(f => f.ForeignColumns);
            expressionMock.VerifyGet(e => e.ForeignKey);
        }
Ejemplo n.º 7
0
        public void CallingOnTableSetsForeignTableName()
        {
            var foreignKeyMock = new Mock <ForeignKeyDefinition>();

            foreignKeyMock.SetupSet(f => f.ForeignTable = "Bacon").AtMostOnce();

            var expressionMock = new Mock <DeleteForeignKeyExpression>();

            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object).AtMostOnce();

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);

            ((IDeleteForeignKeyOnTableSyntax)builder).OnTable(("Bacon"));

            foreignKeyMock.VerifyAll();
            expressionMock.VerifyAll();
        }
        public void CallingPrimaryColumnAddsColumnNameToPrimaryColumnCollection()
        {
            var collectionMock = new Mock <IList <string> >();

            var foreignKeyMock = new Mock <ForeignKeyDefinition>();

            foreignKeyMock.SetupGet(f => f.PrimaryColumns).Returns(collectionMock.Object);

            var expressionMock = new Mock <DeleteForeignKeyExpression>();

            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);

            builder.PrimaryColumn("BaconId");

            collectionMock.Verify(x => x.Add("BaconId"));
            foreignKeyMock.VerifyGet(f => f.PrimaryColumns);
            expressionMock.VerifyGet(e => e.ForeignKey);
        }
Ejemplo n.º 9
0
        public void CallingPrimaryColumnsAddsColumnNamesToForeignColumnCollection()
        {
            var collectionMock = new Mock <IList <string> >();

            collectionMock.Setup(x => x.Add("BaconId")).AtMostOnce();
            collectionMock.Setup(x => x.Add("EggsId")).AtMostOnce();

            var foreignKeyMock = new Mock <ForeignKeyDefinition>();

            foreignKeyMock.SetupGet(f => f.PrimaryColumns).Returns(collectionMock.Object).AtMost(2);

            var expressionMock = new Mock <DeleteForeignKeyExpression>();

            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object).AtMost(2);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);

            builder.PrimaryColumns("BaconId", "EggsId");

            collectionMock.VerifyAll();
            foreignKeyMock.VerifyAll();
            expressionMock.VerifyAll();
        }
        public void CallingPrimaryColumnsAddsColumnNamesToForeignColumnCollection()
        {
            var collectionMock = new Mock<IList<string>>();
            collectionMock.Setup(x => x.Add("BaconId")).AtMostOnce();
            collectionMock.Setup(x => x.Add("EggsId")).AtMostOnce();

            var foreignKeyMock = new Mock<ForeignKeyDefinition>();
            foreignKeyMock.SetupGet(f => f.PrimaryColumns).Returns(collectionMock.Object).AtMost(2);

            var expressionMock = new Mock<DeleteForeignKeyExpression>();
            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object).AtMost(2);

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);
            builder.PrimaryColumns("BaconId", "EggsId");

            collectionMock.VerifyAll();
            foreignKeyMock.VerifyAll();
            expressionMock.VerifyAll();
        }
        public void CallingOnTableSetsForeignTableName()
        {
            var foreignKeyMock = new Mock<ForeignKeyDefinition>();
            foreignKeyMock.VerifySet(f => f.ForeignTable = "Bacon", Times.AtMostOnce());

            var expressionMock = new Mock<DeleteForeignKeyExpression>();
            expressionMock.SetupGet(e => e.ForeignKey).Returns(foreignKeyMock.Object);
            expressionMock.VerifyGet(e => e.ForeignKey, Times.AtMostOnce());

            var builder = new DeleteForeignKeyExpressionBuilder(expressionMock.Object);
            ((IDeleteForeignKeyOnTableSyntax)builder).OnTable(("Bacon"));

            foreignKeyMock.VerifyAll();
            expressionMock.VerifyAll();
        }