public void Subscription() { _uplink.Expect(k => k.OnNext(null)).IgnoreArguments().Repeat.Never(); _mockRepository.ReplayAll(); _pool.Post(Guid.NewGuid(), new UnnotifiedElement()); _mockRepository.VerifyAll(); }
public void PostResource() { _uplink.Replay(); var id = Guid.NewGuid(); _subscriptor.SubscribeForResourceChangePropagation("NotifiedElement", id); _pool.Post(id, new NotifiedElement()); }
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(); }
protected override void WriteResourceTyped(Guid key, T resource) { SpinWait.SpinUntil(() => false, _callDelay); _pool.Post(key, resource); }
public void LocalizedWriting() { var id = Guid.NewGuid(); var el = new NotifiedElement(); _posterFactory.Stub(k => k.PostResourceBlock(null)) .IgnoreArguments() .Return(new DataRecord[0]); _mockRepository.ReplayAll(); using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { _pool.Post(id, el); _posterFactory.AssertWasNotCalled(k => k.PostResourceBlock(null), k => k.IgnoreArguments()); _poster.AssertWasNotCalled(k => k.WriteResourceRegardlessofTransaction(id, el), k => k.IgnoreArguments()); scope.Complete(); } _posterFactory.AssertWasCalled(k => k.PostResourceBlock(null), k => k.IgnoreArguments() .Repeat.Once()); }