public void can_store() { var model = new SampleReadModelWithStringKey() { Id = "a" }; _inmemoryCollection.Save(model); Assert.AreEqual(1, _inmemoryCollection.GetAll().Count()); }
public SaveResult SaveWithVersion(TModel model, int orignalVersion) { if (_inmemoryCollection.IsActive) { // non posso controllare le versioni perché l'istanza è la stessa _inmemoryCollection.Save(model); return(new SaveResult { Ok = true }); } return(_storage.SaveWithVersion(model, orignalVersion)); }
public async Task <SaveResult> SaveWithVersionAsync(TModel model, int orignalVersion) { if (model == null) { throw new ArgumentNullException(nameof(model)); } if (_inmemoryCollection.IsActive) { // non posso controllare le versioni perché l'istanza è la stessa _inmemoryCollection.Save(model); _indexes.Insert(model); return(new SaveResult { Ok = true }); } return(await _storage.SaveWithVersionAsync(model, orignalVersion).ConfigureAwait(false)); }