public void Serialize(IEntity instance, TextWriter output) { output.Write('{'); var first = true; foreach (var component in instance.Components) { if (first) { first = false; } else { output.Write(','); } var componentType = component.GetType(); var componentName = _descriptions.GetComponentName(componentType); var componentConverter = _converters.Get(componentType); output.WriteProperty(componentName); componentConverter.SerializeObject(component, output); } output.Write('}'); }
public void GetComponentName() { var componentType = typeof(TestComponent1); _sourceDescriptions .GetComponentName(componentType) .Should().Be(SourceDescriptions.BuildTypeName(componentType)); }