public void TestInt16Promotion() { DataType[] dtypes = new DataType[] { DataType.DataType_String }; //int16 -> string DataType dt = FdoFeatureService.GetPromotedDataType(DataType.DataType_Int16, dtypes); Assert.AreEqual(DataType.DataType_String, dt); dtypes = new DataType[] { DataType.DataType_String, DataType.DataType_Int64 }; //int16 -> int64 dt = FdoFeatureService.GetPromotedDataType(DataType.DataType_Int16, dtypes); Assert.AreEqual(DataType.DataType_Int64, dt); dtypes = (DataType[])Enum.GetValues(typeof(DataType)); //int16 -> int32 dt = FdoFeatureService.GetPromotedDataType(DataType.DataType_Int16, dtypes); Assert.AreEqual(DataType.DataType_Int32, dt); //No suitable data type dtypes = new DataType[] { DataType.DataType_CLOB, DataType.DataType_BLOB }; try { dt = FdoFeatureService.GetPromotedDataType(DataType.DataType_Int16, dtypes); Assert.Fail("Should have failed to find suitable data type"); } catch (FeatureServiceException) { } }
public void TestDateTimePromotion() { DataType[] dtypes = (DataType[])Enum.GetValues(typeof(DataType)); DataType dt = FdoFeatureService.GetPromotedDataType(DataType.DataType_DateTime, dtypes); Assert.AreEqual(DataType.DataType_String, dt); //No suitable data type dtypes = new DataType[] { DataType.DataType_CLOB, DataType.DataType_BLOB }; try { dt = FdoFeatureService.GetPromotedDataType(DataType.DataType_DateTime, dtypes); Assert.Fail("Should have failed to find suitable data type"); } catch (FeatureServiceException) { } }
public void TestFailedDataTypePromotion() { DataType[] dtypes = (DataType[])Enum.GetValues(typeof(DataType)); try { FdoFeatureService.GetPromotedDataType(DataType.DataType_BLOB, dtypes); Assert.Fail("BLOB is not convertible"); } catch (FeatureServiceException) { } try { FdoFeatureService.GetPromotedDataType(DataType.DataType_CLOB, dtypes); Assert.Fail("CLOB is not convertible"); } catch (FeatureServiceException) { } try { FdoFeatureService.GetPromotedDataType(DataType.DataType_Double, dtypes); Assert.Fail("double is not convertible"); } catch (FeatureServiceException) { } try { FdoFeatureService.GetPromotedDataType(DataType.DataType_String, dtypes); Assert.Fail("string is not convertible"); } catch (FeatureServiceException) { } }