public async Task RemoveRangeRemoves()
        {
            // Arrange
            var addedList = new List <Dummy>();

            foreach (var i in Enumerable.Range(0, 10))
            {
                var id         = Guid.NewGuid().ToString();
                var addedDummy = new Dummy
                {
                    Id   = id,
                    Name = "Test " + i
                };
                await _dummyStore.AddAsync(addedDummy);

                addedList.Add(addedDummy);
            }

            // Act
            var result = await _dummyStore.RemoveRangeAsync(addedList);

            // Assert
            Assert.True(result.IsSuccess);
            Assert.Empty(result.FailedEntities);
        }
示例#2
0
        public async Task DeleteAllByUserIdAsync(Guid userId)
        {
            var flatForRentAnnouncementPreferences = await _cosmosStore.Query().Where(x => x.UserId == userId).ToListAsync();

            var removeResult = await _cosmosStore.RemoveRangeAsync(flatForRentAnnouncementPreferences);

            if (!removeResult.IsSuccess)
            {
                throw new DeleteManyFailureException();
            }
        }
示例#3
0
        public async Task Clear()
        {
            var all = await GetAll();

            await CosmosStore.RemoveRangeAsync(all);
        }