public TEntity Read(JsonData jsonData) { var entityData = (JsonObject)jsonData; var id = (int)_idConverter.ReadValue(entityData) !; var components = (IComponent[]?)_componentsConverter.ReadValue(entityData); if (_customTypeName == null) { return(CreateEntity(null, id, components)); } var entity = CreateEntity(Typeof <TEntity> .Raw, id, components); foreach (var(propertyName, propertyConverter) in _properties) { if (propertyName == nameof(IEntity.Id) || propertyName == nameof(IEntity.Components)) { continue; } propertyConverter.Read(entityData, entity); } return(entity); }
public void ReadValue() { var actual = (IComponent[])_converter.ReadValue(_assetData); var expected = _asset.Components.ToArray(); CompareComponents <TestComponent1>(actual ![0], expected[0]);