예제 #1
0
        public async Task Remove_NoDeletingEntity_NoChanges()
        {
            // Arrange
            var deletingEntityId = Guid.NewGuid();

            var sut = new ClientsRepository(this.mongoCollection);

            // Act
            await sut.Remove(deletingEntityId);

            var actual = await this.mongoCollection
                         .Find(q => q.Id == deletingEntityId)
                         .ToListAsync();

            // Assert
            actual.Should().BeEmpty();
        }
예제 #2
0
        public async Task Remove_ThereIsDeletingEntity_RemovedSuccessfully()
        {
            // Arrange
            var clientEntity = new ClientEntity(Guid.NewGuid(), "Client 1");

            await this.mongoCollection.InsertOneAsync(clientEntity);

            var sut = new ClientsRepository(this.mongoCollection);

            // Act
            await sut.Remove(clientEntity.Id);

            var actual = await this.mongoCollection
                         .Find(q => q.Id == clientEntity.Id)
                         .ToListAsync();

            // Assert
            actual.Should().BeEmpty();
        }