|
|
@ -8,10 +8,7 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Security.Claims; |
|
|
using System.Security.Claims; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using FakeItEasy; |
|
|
using FakeItEasy; |
|
|
using Microsoft.Extensions.Caching.Memory; |
|
|
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
|
|
using Newtonsoft.Json; |
|
|
using Newtonsoft.Json; |
|
|
using Newtonsoft.Json.Linq; |
|
|
using Newtonsoft.Json.Linq; |
|
|
using NodaTime; |
|
|
using NodaTime; |
|
|
@ -28,8 +25,6 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
public class RuleEventFormatterTests |
|
|
public class RuleEventFormatterTests |
|
|
{ |
|
|
{ |
|
|
private readonly JsonSerializer serializer = JsonSerializer.CreateDefault(); |
|
|
private readonly JsonSerializer serializer = JsonSerializer.CreateDefault(); |
|
|
private readonly MemoryCache memoryCache = new MemoryCache(Options.Create(new MemoryCacheOptions())); |
|
|
|
|
|
private readonly IUserResolver userResolver = A.Fake<IUserResolver>(); |
|
|
|
|
|
private readonly IUser user = A.Fake<IUser>(); |
|
|
private readonly IUser user = A.Fake<IUser>(); |
|
|
private readonly IRuleUrlGenerator urlGenerator = A.Fake<IRuleUrlGenerator>(); |
|
|
private readonly IRuleUrlGenerator urlGenerator = A.Fake<IRuleUrlGenerator>(); |
|
|
private readonly NamedId<Guid> appId = NamedId.Of(Guid.NewGuid(), "my-app"); |
|
|
private readonly NamedId<Guid> appId = NamedId.Of(Guid.NewGuid(), "my-app"); |
|
|
@ -45,7 +40,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
A.CallTo(() => user.Claims) |
|
|
A.CallTo(() => user.Claims) |
|
|
.Returns(new List<Claim> { new Claim(SquidexClaimTypes.SquidexDisplayName, "me") }); |
|
|
.Returns(new List<Claim> { new Claim(SquidexClaimTypes.SquidexDisplayName, "me") }); |
|
|
|
|
|
|
|
|
sut = new RuleEventFormatter(serializer, urlGenerator, memoryCache, userResolver); |
|
|
sut = new RuleEventFormatter(serializer, urlGenerator); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
@ -57,7 +52,7 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public void Should_create_route_data() |
|
|
public void Should_create_payload() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent { AppId = appId }; |
|
|
var @event = new EnrichedContentEvent { AppId = appId }; |
|
|
|
|
|
|
|
|
@ -67,98 +62,79 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public void Should_create_route_data_from_event() |
|
|
public void Should_create_envelope_data_from_event() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent { AppId = appId, Name = "MyEventName" }; |
|
|
var @event = new EnrichedContentEvent { AppId = appId, Name = "MyEventName" }; |
|
|
|
|
|
|
|
|
var result = sut.ToPayload(@event); |
|
|
var result = sut.ToEnvelope(@event); |
|
|
|
|
|
|
|
|
Assert.Equal("MyEventName", result["type"]); |
|
|
Assert.Equal("MyEventName", result["type"]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_replace_app_information_from_event() |
|
|
public void Should_replace_app_information_from_event() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent { AppId = appId }; |
|
|
var @event = new EnrichedContentEvent { AppId = appId }; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("Name $APP_NAME has id $APP_ID", @event); |
|
|
var result = sut.Format("Name $APP_NAME has id $APP_ID", @event); |
|
|
|
|
|
|
|
|
Assert.Equal($"Name my-app has id {appId.Id}", result); |
|
|
Assert.Equal($"Name my-app has id {appId.Id}", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_replace_schema_information_from_event() |
|
|
public void Should_replace_schema_information_from_event() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent { SchemaId = schemaId }; |
|
|
var @event = new EnrichedContentEvent { SchemaId = schemaId }; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("Name $SCHEMA_NAME has id $SCHEMA_ID", @event); |
|
|
var result = sut.Format("Name $SCHEMA_NAME has id $SCHEMA_ID", @event); |
|
|
|
|
|
|
|
|
Assert.Equal($"Name my-schema has id {schemaId.Id}", result); |
|
|
Assert.Equal($"Name my-schema has id {schemaId.Id}", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_replace_timestamp_information_from_event() |
|
|
public void Should_replace_timestamp_information_from_event() |
|
|
{ |
|
|
{ |
|
|
var now = DateTime.UtcNow; |
|
|
var now = DateTime.UtcNow; |
|
|
|
|
|
|
|
|
var envelope = new EnrichedContentEvent { Timestamp = Instant.FromDateTimeUtc(now) }; |
|
|
var envelope = new EnrichedContentEvent { Timestamp = Instant.FromDateTimeUtc(now) }; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("Date: $TIMESTAMP_DATE, Full: $TIMESTAMP_DATETIME", envelope); |
|
|
var result = sut.Format("Date: $TIMESTAMP_DATE, Full: $TIMESTAMP_DATETIME", envelope); |
|
|
|
|
|
|
|
|
Assert.Equal($"Date: {now:yyyy-MM-dd}, Full: {now:yyyy-MM-dd-hh-mm-ss}", result); |
|
|
Assert.Equal($"Date: {now:yyyy-MM-dd}, Full: {now:yyyy-MM-dd-hh-mm-ss}", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_format_email_and_display_name_from_user() |
|
|
public void Should_format_email_and_display_name_from_user() |
|
|
{ |
|
|
{ |
|
|
A.CallTo(() => userResolver.FindByIdOrEmailAsync("123")) |
|
|
var @event = new EnrichedContentEvent { User = user, Actor = new RefToken("subject", "123") }; |
|
|
.Returns(user); |
|
|
|
|
|
|
|
|
|
|
|
var @event = new EnrichedContentEvent { Actor = new RefToken("subject", "123") }; |
|
|
|
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
var result = sut.Format("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
|
|
|
|
|
|
Assert.Equal($"From me (me@email.com)", result); |
|
|
Assert.Equal($"From me (me@email.com)", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_if_user_is_not_found() |
|
|
public void Should_return_undefined_if_user_is_not_found() |
|
|
{ |
|
|
{ |
|
|
A.CallTo(() => userResolver.FindByIdOrEmailAsync("123")) |
|
|
|
|
|
.Returns(Task.FromResult<IUser>(null)); |
|
|
|
|
|
|
|
|
|
|
|
var @event = new EnrichedContentEvent { Actor = new RefToken("subject", "123") }; |
|
|
var @event = new EnrichedContentEvent { Actor = new RefToken("subject", "123") }; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
var result = sut.Format("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
|
|
|
|
|
|
Assert.Equal($"From UNDEFINED (UNDEFINED)", result); |
|
|
Assert.Equal($"From UNDEFINED (UNDEFINED)", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_if_user_failed_to_resolve() |
|
|
public void Should_format_email_and_display_name_from_client() |
|
|
{ |
|
|
|
|
|
A.CallTo(() => userResolver.FindByIdOrEmailAsync("123")) |
|
|
|
|
|
.Throws(new InvalidOperationException()); |
|
|
|
|
|
|
|
|
|
|
|
var @event = new EnrichedContentEvent { Actor = new RefToken("subject", "123") }; |
|
|
|
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
|
|
|
|
|
|
|
|
|
Assert.Equal($"From UNDEFINED (UNDEFINED)", result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public async Task Should_format_email_and_display_name_from_client() |
|
|
|
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent { Actor = new RefToken("client", "android") }; |
|
|
var @event = new EnrichedContentEvent { Actor = new RefToken("client", "android") }; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
var result = sut.Format("From $USER_NAME ($USER_EMAIL)", @event); |
|
|
|
|
|
|
|
|
Assert.Equal($"From client:android (client:android)", result); |
|
|
Assert.Equal($"From client:android (client:android)", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_replace_content_url_from_event() |
|
|
public void Should_replace_content_url_from_event() |
|
|
{ |
|
|
{ |
|
|
var url = "http://content"; |
|
|
var url = "http://content"; |
|
|
|
|
|
|
|
|
@ -167,13 +143,19 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
|
|
|
|
|
|
var @event = new EnrichedContentEvent { AppId = appId, Id = contentId, SchemaId = schemaId }; |
|
|
var @event = new EnrichedContentEvent { AppId = appId, Id = contentId, SchemaId = schemaId }; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("Go to $CONTENT_URL", @event); |
|
|
var result = sut.Format("Go to $CONTENT_URL", @event); |
|
|
|
|
|
|
|
|
Assert.Equal($"Go to {url}", result); |
|
|
Assert.Equal($"Go to {url}", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_when_field_not_found() |
|
|
public void Should_format_content_url_when_not_found() |
|
|
|
|
|
{ |
|
|
|
|
|
Assert.Equal("UNDEFINED", sut.Format("$CONTENT_URL", new EnrichedAssetEvent())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void Should_return_undefined_when_field_not_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -184,13 +166,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", "Berlin")) |
|
|
.AddValue("iv", "Berlin")) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.country.iv", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.country.iv", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("UNDEFINED", result); |
|
|
Assert.Equal("UNDEFINED", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_when_partition_not_found() |
|
|
public void Should_return_undefined_when_partition_not_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -201,13 +183,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", "Berlin")) |
|
|
.AddValue("iv", "Berlin")) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.de", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.de", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("UNDEFINED", result); |
|
|
Assert.Equal("UNDEFINED", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_when_array_item_not_found() |
|
|
public void Should_return_undefined_when_array_item_not_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -218,13 +200,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", new JArray())) |
|
|
.AddValue("iv", new JArray())) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.de.10", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.de.10", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("UNDEFINED", result); |
|
|
Assert.Equal("UNDEFINED", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_when_property_not_found() |
|
|
public void Should_return_undefined_when_property_not_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -236,13 +218,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
new JProperty("name", "Berlin")))) |
|
|
new JProperty("name", "Berlin")))) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.de.Name", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.de.Name", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("UNDEFINED", result); |
|
|
Assert.Equal("UNDEFINED", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_plain_value_when_found() |
|
|
public void Should_return_plain_value_when_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -253,13 +235,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", "Berlin")) |
|
|
.AddValue("iv", "Berlin")) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("Berlin", result); |
|
|
Assert.Equal("Berlin", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_plain_value_when_found_from_update_event() |
|
|
public void Should_return_plain_value_when_found_from_update_event() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -270,13 +252,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", "Berlin")) |
|
|
.AddValue("iv", "Berlin")) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("Berlin", result); |
|
|
Assert.Equal("Berlin", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_when_null() |
|
|
public void Should_return_undefined_when_null() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -287,13 +269,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", JValue.CreateNull())) |
|
|
.AddValue("iv", JValue.CreateNull())) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("UNDEFINED", result); |
|
|
Assert.Equal("UNDEFINED", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_undefined_when_undefined() |
|
|
public void Should_return_undefined_when_undefined() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -304,13 +286,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
.AddValue("iv", JValue.CreateUndefined())) |
|
|
.AddValue("iv", JValue.CreateUndefined())) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("UNDEFINED", result); |
|
|
Assert.Equal("UNDEFINED", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_string_when_object() |
|
|
public void Should_return_string_when_object() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -322,13 +304,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
new JProperty("name", "Berlin")))) |
|
|
new JProperty("name", "Berlin")))) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv", @event); |
|
|
|
|
|
|
|
|
Assert.Equal(JObject.FromObject(new { name = "Berlin" }).ToString(Formatting.Indented), result); |
|
|
Assert.Equal(JObject.FromObject(new { name = "Berlin" }).ToString(Formatting.Indented), result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_plain_value_from_array_when_found() |
|
|
public void Should_return_plain_value_from_array_when_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -340,13 +322,13 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
"Berlin"))) |
|
|
"Berlin"))) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv.0", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv.0", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("Berlin", result); |
|
|
Assert.Equal("Berlin", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_return_plain_value_from_object_when_found() |
|
|
public void Should_return_plain_value_from_object_when_found() |
|
|
{ |
|
|
{ |
|
|
var @event = new EnrichedContentEvent |
|
|
var @event = new EnrichedContentEvent |
|
|
{ |
|
|
{ |
|
|
@ -358,18 +340,21 @@ namespace Squidex.Domain.Apps.Core.Operations.HandleRules |
|
|
new JProperty("name", "Berlin")))) |
|
|
new JProperty("name", "Berlin")))) |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var result = await sut.FormatStringAsync("$CONTENT_DATA.city.iv.name", @event); |
|
|
var result = sut.Format("$CONTENT_DATA.city.iv.name", @event); |
|
|
|
|
|
|
|
|
Assert.Equal("Berlin", result); |
|
|
Assert.Equal("Berlin", result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_format_content_actions_when_found() |
|
|
public void Should_format_content_actions_when_found() |
|
|
|
|
|
{ |
|
|
|
|
|
Assert.Equal("created", sut.Format("$CONTENT_ACTION", new EnrichedContentEvent { Type = EnrichedContentEventType.Created })); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void Should_format_content_actions_when_not_found() |
|
|
{ |
|
|
{ |
|
|
Assert.Equal("created", await sut.FormatStringAsync("$CONTENT_ACTION", new EnrichedContentEvent { Action = EnrichedContentEventAction.Created })); |
|
|
Assert.Equal("UNDEFINED", sut.Format("$CONTENT_ACTION", new EnrichedAssetEvent())); |
|
|
Assert.Equal("updated", await sut.FormatStringAsync("$CONTENT_ACTION", new EnrichedContentEvent { Action = EnrichedContentEventAction.Updated })); |
|
|
|
|
|
Assert.Equal("deleted", await sut.FormatStringAsync("$CONTENT_ACTION", new EnrichedContentEvent { Action = EnrichedContentEventAction.Deleted })); |
|
|
|
|
|
Assert.Equal("archived", await sut.FormatStringAsync("$CONTENT_ACTION", new EnrichedContentEvent { Action = EnrichedContentEventAction.Archived })); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|