Skip to content

Commit

Permalink
Add failing test for not increasing version
Browse files Browse the repository at this point in the history
  • Loading branch information
e-tobi committed May 10, 2024
1 parent 92795c8 commit f93ea0a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/DocumentDbTests/Concurrency/numeric_revisioning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,30 @@ public async Task store_twice_with_no_version_can_override()
(await theSession.LoadAsync<RevisionedDoc>(doc1.Id)).Name.ShouldBe("Brad");
}

[Fact]
public async Task each_store_should_increase_the_version()
{
var doc1 = new RevisionedDoc { Name = "Tim" };
theSession.Store(doc1);
theSession.SaveChanges();
doc1.Version.ShouldBe(1);

doc1.Name = "Brad";
theSession.Store(doc1);
theSession.SaveChanges();
doc1.Version.ShouldBe(2);

doc1.Name = "Janet";
theSession.Store(doc1);
theSession.SaveChanges();
doc1.Version.ShouldBe(3);

doc1.Name = "Arthur";
theSession.Store(doc1);
theSession.SaveChanges();
doc1.Version.ShouldBe(4);
}

[Fact]
public async Task optimistic_concurrency_failure_with_update_revision()
{
Expand Down

0 comments on commit f93ea0a

Please sign in to comment.