public void PostResourceTest() { GetResourceTest(); ITypedPool target = CreateITransientCachier(); target.Post(_dependentModel.Key, _singleModel); var actModel = target.Get <Model>(_dependentModel.Key); Assert.AreEqual(_singleModel.Key, actModel.Key); Assert.AreEqual(_singleModel.Name, actModel.Name); target.Post <Model>(_dependentModel.Key, null); actModel = target.Get <Model>(_dependentModel.Key); Assert.AreEqual(null, actModel); target.Post(_dependentElement.Key, _singleElement); var actElement = target.Get <Element>(_dependentElement.Key); Assert.AreEqual(_singleElement.Key, actElement.Key); Assert.AreEqual(_singleElement.Name, actElement.Name); target.Post <Element>(_dependentElement.Key, null); actElement = target.Get <Element>(_dependentElement.Key); Assert.AreEqual(null, actElement); target.Post <Element>(_dependentElement.Key, null);//удаление отсуствующего ключа должно работать без ошибок target.Post(_dependentElement.Key, _dependentElement); target.Post(_dependentModel.Key, _dependentModel); GetResourceTest(); }
public void LocalizedWritingGetting() { var id = Guid.NewGuid(); var el = new NotifiedElement { Name = "Test" }; _posterFactory.Stub(k => k.PostResourceBlock(null)) .IgnoreArguments() .Return(new DataRecord[0]); _mockRepository.ReplayAll(); var el2 = _pool.Get <NotifiedElement>(id); Assert.IsNull(el2); using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { _pool.Post(id, el); el2 = _pool.Get <NotifiedElement>(id); _getter.AssertWasNotCalled(k => k.GetItemTypedProxy(id), k => k.IgnoreArguments()); Assert.IsNotNull(el2); Assert.AreEqual(el.Name, el2.Name); scope.Complete(); } _posterFactory.AssertWasCalled(k => k.PostResourceBlock(null), k => k.IgnoreArguments() .Repeat.Once()); }
protected override T GetItemTyped(Guid id) { SpinWait.SpinUntil(() => false, _callDelay); return(_pool.Get <T>(id)); }
public static IEnumerable <T> QueryFilled <T>(this ITypedPool cachier, UriQuery query) where T : class { return(cachier.Get <T>(cachier.Query <T>(query))); }
public static IEnumerable <T> FindFilled <T>(this ITypedPool cachier, object query) where T : class { return(cachier.Get <T>(cachier.Find <T>(query))); }
public static IEnumerable <TResource> GetFilled <TResource, TLink>(this ITypedPool cachier, Guid id) where TResource : class { return(cachier.Get <TResource>(cachier.Get <TResource, TLink>(id))); }
public static IEnumerable <T> GetFilled <T>(this ITypedPool cachier, Func <IEnumerable <Guid> > query) where T : class { return(cachier.Get <T>(query())); }