public void StringFixedLengthCommonLength() { CustomDbParameter parameter = new CustomDbParameter(); PropertyInfo info = typeof(DbTypeModel).GetProperty(nameof(DbTypeModel.StringFixedLength)); string value = _faker.Random.String(_faker.Random.Int(0, 3999)); _formatter.MapDbParameter(parameter, value, info); Assert.AreEqual(parameter.Size, 4000); Assert.AreEqual((string)parameter.Value, value); Assert.AreEqual(parameter.DbType, DbType.StringFixedLength); }
public void MapNonNativeGuidProperty() { Guid guid = _faker.Random.Guid(); DbParameterFormatter formatter = new DbParameterFormatter(false); CustomDbParameter parameter = new CustomDbParameter(); PropertyInfo info = typeof(Employee).GetProperty(nameof(Employee.EmployeeID)); formatter.MapDbParameter(parameter, guid, info); Assert.IsInstanceOf(typeof(string), parameter.Value); Assert.IsTrue(parameter.DbType == DbType.String); Assert.IsTrue((string)parameter.Value == guid.ToString()); Assert.IsTrue(parameter.Size == 40); }