public async void Guards() { var exception = await Assert.ThrowsAsync <ArgumentNullException>( () => collection.AddAsync <object>(null) ); Assert.Equal("item", exception.ParamName); }
public async void DeleteSuccessPurge() { var item = new Product { Id = 3, Name = "Bread", Description = "Whole Grain Bread", Price = 2.75M, Rating = 3 }; var kvMetaData = await collection.AddAsync(item); await collection.DeleteAsync(kvMetaData.Key); var exception = await Assert.ThrowsAsync <NotFoundException>( () => collection.GetAsync <object>(kvMetaData.Key, kvMetaData.VersionReference) ); Assert.Equal(HttpStatusCode.NotFound, exception.StatusCode); string expected = String.Format("Key: {0} was not found in collection: {1}", kvMetaData.Key, collectionName); Assert.Equal(expected, exception.Message); }
public async void TryAddFailsWithExistingKey() { var item = new Product { Id = 3, Name = "Bread", Description = "Whole Grain Bread", Price = 2.75M, Rating = 3 }; var kvMetaData = await collection.AddAsync(item); var exception = await Assert.ThrowsAsync <RequestException>( () => collection.TryAddAsync <Product>(kvMetaData.Key, item)); Assert.Equal(HttpStatusCode.PreconditionFailed, exception.StatusCode); }
public async Task AddAsync(Category category) { await Collection.AddAsync(category); await _database.SaveChangesAsync(); }
public async Task AddAsync(Activity activity) { await Collection.AddAsync(activity); await _database.SaveChangesAsync(); }
public async Task AddAsync(User user) { await Collection.AddAsync(user); await _database.SaveChangesAsync(); }
public async Task Add(Person person) { var model = mapper.Map <Models.Person>(person); await Collection.AddAsync(model); }