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_restores_memento_correctly() { // Arrange var userId = Guid.NewGuid(); FakeUserMemento memento = fixture.Create <FakeUserMemento>(); await sut.Save <FakeUser>(userId, memento, CancellationToken.None); // Act IMemento actual = await sut.Find <FakeUser>(userId, CancellationToken.None); // Assert actual.Should().BeOfType <FakeUserMemento>(); actual.ShouldBeEquivalentTo(memento); }
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); }