public void SuccessfulTryGetExistingAlias(string alias) { var id = _sourceDescriptions.GetOrAddAlias(alias); _sourceDescriptions.TryGetAlias(id, out var actual).Should().BeTrue(); actual.Should().Be(alias); }
public void Serialize(IEntity instance, TextWriter output) { var instanceId = instance.Id; if (_descriptions.TryGetAlias(instanceId, out var alias)) { output.WriteString(alias); } else { output.Write(instanceId); } }
protected void SerializeEntity(TEntity?entity, TextWriter output) { if (entity == null) { output.Write(JsonValue.NullToken); return; } var entityId = entity.Id; if (_descriptions.TryGetAlias(entityId, out var alias)) { output.WriteString(alias); } else { output.Write(entityId); } }