public async Task ThenAccountIsUpdatedIfExisting(
            AccountsRepository sut,
            AccountEntity newEntity)
        {
            // Arrange
            await sut.AddOrUpdate(newEntity);

            var expectedCountAfterUpdate = (await sut.GetList()).Count;

            // Act
            await sut.AddOrUpdate(newEntity);

            // Assert
            var actualCountAfterAdd = (await sut.GetList()).Count;

            actualCountAfterAdd.Should().Be(expectedCountAfterUpdate);
        }
        public async Task ThenAccountIsAddedIfNew(
            AccountsRepository sut,
            AccountEntity newEntity)
        {
            var expectedCountAfterAdd = (await sut.GetList()).Count + 1;

            // Act
            await sut.AddOrUpdate(newEntity);

            // Assert
            var actualCountAfterAdd = (await sut.GetList()).Count;

            actualCountAfterAdd.Should().Be(expectedCountAfterAdd);
        }
Exemplo n.º 3
0
        public async Task ThenAccountCanBeFoundByIndex(
            AccountsRepository sut,
            AccountEntity newEntity)
        {
            // Arrange
            await sut.AddOrUpdate(newEntity);

            // Act
            var entity = await sut.Find(newEntity.Id);

            // Assert
            entity.Should().NotBe(newEntity);
            entity.Id.Should().Be(newEntity.Id);
            entity.Name.Should().Be(newEntity.Name);
        }