|
|
@ -34,38 +34,38 @@ namespace Squidex.Domain.Apps.Entities.Contents.Queries |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_throw_exception_if_no_state_returned() |
|
|
public async Task Should_return_null_if_no_state_returned() |
|
|
{ |
|
|
{ |
|
|
A.CallTo(() => grain.GetStateAsync(10)) |
|
|
A.CallTo(() => grain.GetStateAsync(10)) |
|
|
.Returns(J.Of<IContentEntity>(null!)); |
|
|
.Returns(J.Of<IContentEntity>(null!)); |
|
|
|
|
|
|
|
|
await Assert.ThrowsAsync<DomainObjectNotFoundException>(() => sut.GetAsync(appId, id, 10)); |
|
|
Assert.Null(await sut.GetAsync(appId, id, 10)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_throw_exception_if_state_empty() |
|
|
public async Task Should_return_null_if_state_empty() |
|
|
{ |
|
|
{ |
|
|
var content = new ContentEntity { Version = EtagVersion.Empty }; |
|
|
var content = new ContentEntity { Version = EtagVersion.Empty }; |
|
|
|
|
|
|
|
|
A.CallTo(() => grain.GetStateAsync(10)) |
|
|
A.CallTo(() => grain.GetStateAsync(10)) |
|
|
.Returns(J.Of<IContentEntity>(content)); |
|
|
.Returns(J.Of<IContentEntity>(content)); |
|
|
|
|
|
|
|
|
await Assert.ThrowsAsync<DomainObjectNotFoundException>(() => sut.GetAsync(appId, id, 10)); |
|
|
Assert.Null(await sut.GetAsync(appId, id, 10)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_throw_exception_if_state_has_other_version() |
|
|
public async Task Should_return_null_if_state_has_other_version() |
|
|
{ |
|
|
{ |
|
|
var content = new ContentEntity { Version = 5 }; |
|
|
var content = new ContentEntity { Version = 5 }; |
|
|
|
|
|
|
|
|
A.CallTo(() => grain.GetStateAsync(10)) |
|
|
A.CallTo(() => grain.GetStateAsync(10)) |
|
|
.Returns(J.Of<IContentEntity>(content)); |
|
|
.Returns(J.Of<IContentEntity>(content)); |
|
|
|
|
|
|
|
|
await Assert.ThrowsAsync<DomainObjectNotFoundException>(() => sut.GetAsync(appId, id, 10)); |
|
|
Assert.Null(await sut.GetAsync(appId, id, 10)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public async Task Should_not_throw_exception_if_state_has_other_version_than_any() |
|
|
public async Task Should_not_return_null_if_state_has_other_version_than_any() |
|
|
{ |
|
|
{ |
|
|
var content = new ContentEntity { Version = 5 }; |
|
|
var content = new ContentEntity { Version = 5 }; |
|
|
|
|
|
|
|
|
|