From 819fc246dead6f37f8759a9ac93e6470bad60d55 Mon Sep 17 00:00:00 2001 From: Michael L Perry Date: Thu, 18 Jan 2024 21:21:12 -0600 Subject: [PATCH] Test version consistency --- .../Specifications/ProjectionVersioningTest.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Jinaga.Test/Specifications/ProjectionVersioningTest.cs b/Jinaga.Test/Specifications/ProjectionVersioningTest.cs index 876d7e6a..4e13247b 100644 --- a/Jinaga.Test/Specifications/ProjectionVersioningTest.cs +++ b/Jinaga.Test/Specifications/ProjectionVersioningTest.cs @@ -38,18 +38,21 @@ public async Task CanReadVersionTwoFieldFromVersionOneFact() var jinagaClient = JinagaTest.Create(); var site = await jinagaClient.Fact(new Model.Site(new User("Michael"), "michaelperry.net")); var contentV1 = await jinagaClient.Fact(new Model.Content(site, "index.html")); + var originalHash = jinagaClient.Hash(contentV1); var contentCreatedAtForSite = Given.Match((site, facts) => from content in facts.OfType() where content.site == site select new { - content.createdAt + content.createdAt, + hash = jinagaClient.Hash(content) } ); var contentCreatedAt = await jinagaClient.Query(contentCreatedAtForSite, site); contentCreatedAt.Should().ContainSingle().Which.createdAt.Should().BeNull(); + contentCreatedAt.Should().ContainSingle().Which.hash.Should().Be(originalHash); } [Fact] @@ -58,18 +61,21 @@ public async Task CanReadVersionTwoFieldFromVersionTwoFact() var jinagaClient = JinagaTest.Create(); var site = await jinagaClient.Fact(new Model.Site(new User("Michael"), "michaelperry.net")); var contentV2 = await jinagaClient.Fact(new Model.ContentV2(site, new DateTime(2021, 1, 1).ToUniversalTime())); + var originalHash = jinagaClient.Hash(contentV2); var contentCreatedAtForSite = Given.Match((site, facts) => from content in facts.OfType() where content.site == site select new { - content.createdAt + content.createdAt, + hash = jinagaClient.Hash(content) } ); var contentCreatedAt = await jinagaClient.Query(contentCreatedAtForSite, site); contentCreatedAt.Should().ContainSingle().Which.createdAt.Should().Be(new DateTime(2021, 1, 1).ToUniversalTime()); + contentCreatedAt.Should().ContainSingle().Which.hash.Should().Be(originalHash); } [Fact] @@ -78,17 +84,20 @@ public async Task CanReadVersionOneFieldFromVersionTwoFact() var jinagaClient = JinagaTest.Create(); var site = await jinagaClient.Fact(new Model.Site(new User("Michael"), "michaelperry.net")); var contentV2 = await jinagaClient.Fact(new Model.ContentV2(site, new DateTime(2021, 1, 1))); + var originalHash = jinagaClient.Hash(contentV2); var contentPathForSite = Given.Match((site, facts) => from content in facts.OfType() where content.site == site select new { - content.path + content.path, + hash = jinagaClient.Hash(content) } ); var contentPath = await jinagaClient.Query(contentPathForSite, site); contentPath.Should().ContainSingle().Which.path.Should().Be(""); + contentPath.Should().ContainSingle().Which.hash.Should().Be(originalHash); } }