예제 #1
0
        public Task UpdateAsync(string id, TModel data)
        {
            if (id == null)
            {
                throw new ArgumentNullException($"{nameof(id)} cannot be null");
            }

            return(Collection.ReplaceOneAsync(d => d.Id == id, data));
        }
예제 #2
0
        public void UpdateAsync_Any_ReplaceOneAsyncCalled()
        {
            string id    = "AnyId";
            var    model = new AnyModel
            {
                AnyString = "AnyString"
            };

            _repository.UpdateAsync(id, model);

            A.CallTo(() => _collection.ReplaceOneAsync(A <Expression <Func <AnyModel, bool> > > .Ignored, model)).MustHaveHappenedOnceExactly();
        }