Browse Source

Tests fixed.

pull/431/head
Sebastian Stehle 6 years ago
parent
commit
bb4f09f20b
  1. 2
      src/Squidex.Infrastructure/Commands/LogSnapshotDomainObjectGrain.cs
  2. 2
      tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs
  3. 12
      tests/Squidex.Infrastructure.Tests/Commands/LogSnapshotDomainObjectGrainTests.cs

2
src/Squidex.Infrastructure/Commands/LogSnapshotDomainObjectGrain.cs

@ -36,7 +36,7 @@ namespace Squidex.Infrastructure.Commands
public T GetSnapshot(long version)
{
if (version <= EtagVersion.Any)
if (version == EtagVersion.Any || version == EtagVersion.Auto)
{
return Snapshot;
}

2
tests/Squidex.Domain.Apps.Entities.Tests/Contents/Queries/ContentLoaderTests.cs

@ -55,7 +55,7 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries
{
var content = new ContentEntity { Version = 5 };
A.CallTo(() => grain.GetStateAsync(10))
A.CallTo(() => grain.GetStateAsync(EtagVersion.Any))
.Returns(J.Of<IContentEntity>(content));
await sut.GetAsync(id, EtagVersion.Any);

12
tests/Squidex.Infrastructure.Tests/Commands/LogSnapshotDomainObjectGrainTests.cs

@ -93,6 +93,16 @@ namespace Squidex.Infrastructure.Commands
result.Should().BeEquivalentTo(new MyDomainState { Value = 8, Version = 1 });
}
[Fact]
public async Task Should_get_latestet_version_when_requesting_state_with_auto()
{
await SetupUpdatedAsync();
var result = sut.GetSnapshot(EtagVersion.Auto);
result.Should().BeEquivalentTo(new MyDomainState { Value = 8, Version = 1 });
}
[Fact]
public async Task Should_get_empty_version_when_requesting_state_with_empty_version()
{
@ -117,7 +127,7 @@ namespace Squidex.Infrastructure.Commands
{
await SetupUpdatedAsync();
Assert.Null(sut.GetSnapshot(-3));
Assert.Null(sut.GetSnapshot(-4));
Assert.Null(sut.GetSnapshot(2));
}

Loading…
Cancel
Save