public void GetEntityTypeByName() { var entityType = typeof(TestAsset); _sourceDescriptions .GetEntityType(SourceDescriptions.BuildTypeName(entityType)) .Should().Be(entityType); }
public void GetComponentName() { var componentType = typeof(TestComponent1); _sourceDescriptions .GetComponentName(componentType) .Should().Be(SourceDescriptions.BuildTypeName(componentType)); }
protected EntityConverter(IServiceProvider services, bool isCustomType) { Contract = Typeof <TEntity> .Raw; _customTypeName = isCustomType ? SourceDescriptions.BuildTypeName(Typeof <TEntity> .Raw) : null; _properties = SerializationUtils.ActivatePropertyConverters <TEntity>(services); _idConverter = (IdConverter)_properties[nameof(IEntity.Id)]; _componentsConverter = (ComponentsConverter)_properties[nameof(IEntity.Components)]; }
public ComponentsConverterShould() { var provider = new DependencyCollection() .AddECS() .BuildProvider(); var components = new IComponent[] { Fixture.Create <TestComponent1>(), Fixture.Create <TestComponent2>() }; _asset = new TestAsset(1, components) { Reference = CreateAsset(2) }; var converters = provider.GetRequired <IConvertersCollection>(); _converter = provider.Activate <ComponentsConverter>(); _assetData = (JsonObject)converters.Write(_asset); _component1Name = SourceDescriptions.BuildTypeName(typeof(TestComponent1)); _component2Name = SourceDescriptions.BuildTypeName(typeof(TestComponent2)); }
public void NotReplaceWordsInEntityTypeName(Type type) { SourceDescriptions .BuildTypeName(type) .Should().Be(type.Name); }
public void ReplaceComponentWord() { SourceDescriptions .BuildTypeName(typeof(TestComponent1)) .Should().Be(nameof(TestComponent1).Cut("Component")); }