public void CallingGeneratedIdentityMinMaxSetsAdditionalProperties()
        {
            var contextMock = new Mock <IMigrationContext>();

            var columnMock = new Mock <ColumnDefinition>();

            columnMock.SetupGet(x => x.Name).Returns("BaconId");

            var expressionMock = new Mock <CreateColumnExpression>();

            expressionMock.SetupGet(x => x.Column).Returns(columnMock.Object);

            var builder = new CreateColumnExpressionBuilder(expressionMock.Object, contextMock.Object);

            builder.Identity(OracleGenerationType.Always, startWith: 0, incrementBy: 1, minValue: 0, long.MaxValue);

            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(OracleExtensions.IdentityGeneration, OracleGenerationType.Always));
            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(OracleExtensions.IdentityStartWith, 0L));
            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(OracleExtensions.IdentityIncrementBy, 1));
            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(OracleExtensions.IdentityMinValue, 0L));
            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(OracleExtensions.IdentityMaxValue, long.MaxValue));
        }
Exemplo n.º 2
0
        public void CallingPostgresGeneratedIdentitySetsAdditionalProperties()
        {
            var contextMock = new Mock <IMigrationContext>();

            var columnMock = new Mock <ColumnDefinition>();

            columnMock.SetupGet(x => x.Name).Returns("BaconId");

            var expressionMock = new Mock <CreateColumnExpression>();

            expressionMock.SetupGet(x => x.Column).Returns(columnMock.Object);

            var builder = new CreateColumnExpressionBuilder(expressionMock.Object, contextMock.Object);

            builder.Identity(PostgresGenerationType.Always);

            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(PostgresExtensions.IdentityGeneration, PostgresGenerationType.Always));
        }
        public void CallingSeededIdentitySetsAdditionalProperties()
        {
            var contextMock = new Mock <IMigrationContext>();

            var columnMock = new Mock <ColumnDefinition>();

            columnMock.SetupGet(x => x.Name).Returns("BaconId");

            var expressionMock = new Mock <CreateColumnExpression>();

            expressionMock.SetupGet(x => x.Column).Returns(columnMock.Object);

            var builder = new CreateColumnExpressionBuilder(expressionMock.Object, contextMock.Object);

            builder.Identity(23, 44);

            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(SqlServerExtensions.IdentitySeed, 23));
            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair <string, object>(SqlServerExtensions.IdentityIncrement, 44));
        }
        public void CallingSeededIdentitySetsAdditionalProperties() 
        {
            var contextMock = new Mock<IMigrationContext>();

            var columnMock = new Mock<ColumnDefinition>();
            columnMock.SetupGet(x => x.Name).Returns("BaconId");

            var expressionMock = new Mock<CreateColumnExpression>();
            expressionMock.SetupGet(x => x.Column).Returns(columnMock.Object);

            var builder = new CreateColumnExpressionBuilder(expressionMock.Object, contextMock.Object);
            builder.Identity(23, 44);

            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair<string, object>(SqlServerExtensions.IdentitySeed, 23));
            columnMock.Object.AdditionalFeatures.ShouldContain(
                new KeyValuePair<string, object>(SqlServerExtensions.IdentityIncrement, 44));
        }