Browse Source

Migration

pull/596/head
Sebastian 5 years ago
parent
commit
b2378c666e
  1. 34
      backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs

34
backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs

@ -241,37 +241,15 @@ namespace TestSuite.ApiTests
// STEP 2: Make an update with the upsert endpoint. // STEP 2: Make an update with the upsert endpoint.
content = await _.Contents.UpsertAsync(id, new TestEntityData { Number = 2 }, true); content = await _.Contents.UpsertAsync(id, new TestEntityData { Number = 2 });
Assert.Equal(2, content.Version); Assert.Equal(2, content.Data.Number);
}
finally
{
if (content != null)
{
await _.Contents.DeleteAsync(content.Id);
}
}
}
[Fact]
public async Task Should_upsert_item()
{
var id = Guid.NewGuid().ToString();
TestEntity content = null;
try
{
// STEP 1: Upsert a new item with a custom id.
content = await _.Contents.UpsertAsync(id, new TestEntityData { Number = 1 }, true);
// STEP 3: Make an update with the update endpoint.
content = await _.Contents.UpdateAsync(id, new TestEntityData { Number = 3 });
// STEP 2: Upsert the item with a custom id and ensure that is has been updated. Assert.Equal(3, content.Data.Number);
await _.Contents.UpsertAsync(id, new TestEntityData { Number = 2 });
var updated = await _.Contents.GetAsync(content.Id);
Assert.Equal(2, updated.Data.Number);
} }
finally finally
{ {
@ -297,7 +275,7 @@ namespace TestSuite.ApiTests
var updated = await _.Contents.GetAsync(content.Id); var updated = await _.Contents.GetAsync(content.Id);
Assert.Equal(2, updated.Data.Number); Assert.Equal(2, content.Data.Number);
} }
finally finally
{ {

Loading…
Cancel
Save