public void TestGetDestinationSystem() { var rootNode = _xmlConversionsReader.GetRootNode(ConversionXmlHelper.Unit4OracleWriterConversionsXml()); var sourceSystem = _xmlConversionsReader.GetDestinationSystem(rootNode); sourceSystem.Should().Be(DatabaseSystemName.ACopy); }
public void TestGetColumnTypeDescription_When_TypeAttributesOk() { var colDesc = _xmlConversionsReader.GetColumnTypeDescription(ConversionXmlHelper.OracleVarchar2()); colDesc.TypeName.Should().Be("varchar2", "because type name is varchar"); colDesc.ConvertTo.Should().Be("varchar", "because varchar2 should be varchar"); }
public static string GetConversionsXmlForNumberWithScaleAndPrec() { return(ConversionXmlHelper.GetHeadingXml() + "<TypeConversions From=\"DB\" To=\"ACopy\">\n" + //ConversionXmlHelper.GetOneTypeNoOperatorXml("number", "dec") + //ConversionXmlHelper.GetOneTypeNoOperatorXml("number(@Prec)", "dec(@Prec)") + ConversionXmlHelper.GetOneTypeNoOperatorXml("number(@Prec,@Scale)", "dec(@Prec,@Scale)") + "</TypeConversions>"); }
public void TestGetDestinationType_When_Int64ToNumber_20_0() { _columnTypeConverter.Initialize(ConversionXmlHelper.Unit4OracleReaderConversionsXml()); var destinationType = _columnTypeConverter.GetDestinationType("int64", ref _length, ref _prec, ref _scale); destinationType.Should().Be("number"); _prec.Should().Be(20); _scale.Should().Be(0); }
public static string GetConversionsXmlForFloat() { return(ConversionXmlHelper.GetHeadingXml() + "<TypeConversions From=\"SqlServer\" To=\"Default\">\n" + "<Type Source=\"float(@Prec)\" Destination=\"binaryfloat\">\n" + " <Prec Operator=\"=\">24</Prec>\n" + "</Type>\n" + "<Type Source=\"float(@Prec)\" Destination=\"binarydouble\">\n" + " <Prec Operator=\"=\">53</Prec>\n" + "</Type>\n" + "<Type Source=\"float(@Prec)\" Destination=\"float(@Prec)\"></Type>\n" + "</TypeConversions>"); }
public void TestGetColumnTypeDescription_When_In() { var colDesc = _xmlConversionsReader.GetColumnTypeDescription(ConversionXmlHelper.OracleGuid()); colDesc.TypeName.Should().Be("raw", "because guid is raw(16) in Oracle"); colDesc.ConvertTo.Should().Be("guid", "because raw(16) should be guid"); colDesc.Constraints.Count.Should().Be(1, "because we should only have Length"); colDesc.Constraints[0].ConstraintType.Should().Be("Length"); colDesc.Constraints[0].Operator.OperatorName.Should().Be(TypeOperatorName.In); colDesc.Constraints[0].Operator.ConstraintValues.Count.Should().Be(4, "because length can be 16 or 17 bytes (or 32 or 34 if unicode)"); colDesc.Constraints[0].Operator.ConstraintValues[0].Should().Be(16); colDesc.Constraints[0].Operator.ConstraintValues[1].Should().Be(32); colDesc.Constraints[0].Operator.ConstraintValues[2].Should().Be(17); colDesc.Constraints[0].Operator.ConstraintValues[3].Should().Be(34); }
public void TestGetColumnTypeDescription_When_PrecisionAndScale() { var colDesc = _xmlConversionsReader.GetColumnTypeDescription(ConversionXmlHelper.OracleBool()); colDesc.TypeName.Should().Be("number", "because type name is number"); colDesc.ConvertTo.Should().Be("bool", "because number(1,0) should be bool"); colDesc.Constraints.Count.Should().Be(2, "because we should have Precision and Scale"); colDesc.Constraints[0].ConstraintType.Should().Be("Prec"); colDesc.Constraints[0].Operator.OperatorName.Should().Be(TypeOperatorName.Eq); colDesc.Constraints[0].Operator.ConstraintValues.Count.Should().Be(1, "because there is only one value for Precision constraint"); colDesc.Constraints[0].Operator.ConstraintValues[0].Should().Be(1, "because Bool has a precision of 1"); colDesc.Constraints[1].ConstraintType.Should().Be("Scale"); colDesc.Constraints[1].Operator.OperatorName.Should().Be(TypeOperatorName.Eq); colDesc.Constraints[1].Operator.ConstraintValues.Count.Should().Be(1, "because there is only one value for Scale constraint"); colDesc.Constraints[1].Operator.ConstraintValues[0].Should().Be(0, "because Bool has a Scale of 0"); }
public void TestGetColumnTypeDescription_When_ToAttributeMissing() { Action act = () => _xmlConversionsReader.GetColumnTypeDescription(ConversionXmlHelper.DestinationAttributeMissingForType()); act.ShouldThrow <XmlException>().WithMessage("Error with attribute 'To' for 'Type'"); }
public void TestGetRootNode_When_LegalXmlButNoConversions() { Action act = () => _xmlConversionsReader.GetRootNode(ConversionXmlHelper.LegalRootButNoConversionsXml()); act.ShouldThrow <XmlException>().WithMessage("No conversions found"); }
public void TestGetRootNode_When_ToAttributeMissing() { Action act = () => _xmlConversionsReader.GetRootNode(ConversionXmlHelper.ToAttributeBlankXml()); act.ShouldThrow <XmlException>().WithMessage("Error with attribute 'To' for 'TypeConversions'"); }
public void TestGetRootNode_When_LegalXmlButIncorrectRootElement() { Action act = () => _xmlConversionsReader.GetRootNode(ConversionXmlHelper.LegalXmlButIncorrectRootElement()); act.ShouldThrow <XmlException>().WithMessage("Can't find root element 'TypeConversions'"); }
public void TestGetColumnTypeDescription_When_IllegalTypeDetail() { Action act = () => _xmlConversionsReader.GetColumnTypeDescription(ConversionXmlHelper.IllegatTypeDetail()); act.ShouldThrow <XmlException>().WithMessage("Illegal type detail 'Illegal' for type 'number(@Prec,@Scale)'"); }
private string GetDestinationTypeWhenOracleToACopy(string input, ref int length, ref int prec, ref int scale) { _columnTypeConverter.Initialize(ConversionXmlHelper.Unit4OracleWriterConversionsXml()); return(_columnTypeConverter.GetDestinationType(input, ref length, ref prec, ref scale)); }