Exemplo n.º 1
0
        [TestMethod] public void GenerateDeclarationWithoutDefault()
        {
            // Arrange
            var name        = new FieldName("CapitalCity");
            var dbType      = DBType.Text;
            var nullability = IsNullable.No;
            var field       = new BasicField(name, dbType, nullability, Option.None <DBValue>());
            var mockBuilder = new Mock <IFieldDeclBuilder>();

            // Act
            _ = field.GenerateSqlDeclaration(mockBuilder.Object);

            // Assert
            mockBuilder.Verify(builder => builder.SetName(name));
            mockBuilder.Verify(builder => builder.SetDataType(dbType));
            mockBuilder.Verify(builder => builder.SetNullability(nullability));
            mockBuilder.Verify(builder => builder.Build());
            mockBuilder.VerifyNoOtherCalls();
        }
Exemplo n.º 2
0
        [TestMethod] public void GenerateDeclarationWithDefault()
        {
            // Arrange
            var name         = new FieldName("GDP");
            var dbType       = DBType.UInt32;
            var nullability  = IsNullable.Yes;
            var defaultValue = DBValue.Create(2500000u);
            var field        = new BasicField(name, dbType, nullability, Option.Some(defaultValue));
            var mockBuilder  = new Mock <IFieldDeclBuilder>();

            // Act
            _ = field.GenerateSqlDeclaration(mockBuilder.Object);

            // Assert
            mockBuilder.Verify(builder => builder.SetName(name));
            mockBuilder.Verify(builder => builder.SetDataType(dbType));
            mockBuilder.Verify(builder => builder.SetNullability(nullability));
            mockBuilder.Verify(builder => builder.SetDefaultValue(defaultValue));
            mockBuilder.Verify(builder => builder.Build());
            mockBuilder.VerifyNoOtherCalls();
        }