public async Task Find_returns_memento_correctly() { var sourceId = Guid.NewGuid(); FakeUserMemento memento = _fixture.Create <FakeUserMemento>(); await _sut.Save <FakeUser>(sourceId, memento, CancellationToken.None); IMemento actual = await _sut.Find <FakeUser>(sourceId, CancellationToken.None); actual.Should().BeOfType <FakeUserMemento>(); actual.ShouldBeEquivalentTo(memento); }
public async Task Find_returns_memento_correctly( Guid sourceId, FakeUserMemento memento) { await sut.Save <FakeUser>(sourceId, memento, CancellationToken.None); IMemento actual = await sut.Find <FakeUser>(sourceId, CancellationToken.None); actual.Should().BeOfType <FakeUserMemento>(); actual.ShouldBeEquivalentTo(memento); }
public async Task Find_returns_null_if_not_exists() { var sourceId = Guid.NewGuid(); var sut = new SqlMementoStore( () => new MementoStoreDbContext(_dbContextOptions), new JsonMessageSerializer()); IMemento actual = await sut.Find <FakeUser>(sourceId, default); actual.Should().BeNull(); }
public async Task Find_returns_memento_correctly() { // Arrange var sourceId = Guid.NewGuid(); var memento = new FakeUserMemento(); var sut = new SqlMementoStore( () => new MementoStoreDbContext(_dbContextOptions), new JsonMessageSerializer()); await sut.Save <FakeUser>(sourceId, memento, default); // Act IMemento actual = await sut.Find <FakeUser>(sourceId, default); // Assert actual.Should().BeOfType <FakeUserMemento>(); actual.ShouldBeEquivalentTo(memento); }