public IdAccessor(IStructureProperty property) : base(property) { if (!property.IsRootMember) { throw new SisoDbException(ExceptionMessages.IdAccessor_InvalidLevel); } if (!StructureId.IsValidDataType(property.DataType)) { throw new SisoDbException(ExceptionMessages.IdAccessor_UnsupportedPropertyType.Inject(Property.DataType.Name)); } IdType = StructureId.GetIdTypeFrom(property.DataType); _getter = StructureIdGetters.For(IdType, Property.DataType); _setter = StructureIdSetters.For(IdType, Property.DataType); }
public void IsValidType_WhenObjectType_ReturnsFalse() { Assert.IsFalse(StructureId.IsValidDataType(typeof(object))); }
public void IsValidType_WhenNullableLong_ReturnsTrue() { Assert.IsTrue(StructureId.IsValidDataType(typeof(long?))); }
public void IsValidType_WhenInt_ReturnsTrue() { Assert.IsTrue(StructureId.IsValidDataType(typeof(int))); }
public void IsValidType_WhenGuid_ReturnsTrue() { Assert.IsTrue(StructureId.IsValidDataType(typeof(Guid))); }
public void IsValidType_WhenString_ReturnsTrue() { Assert.IsTrue(StructureId.IsValidDataType(typeof(string))); }