public void GetOrCreateValue_TwiceWithNullValue_DoesNotEvalueValueFactoryTwice()
        {
            var adapter = new LazyLockingDataStoreAdapter <string, object> (new SimpleDataStore <string, DoubleCheckedLockingContainer <Wrapper> >());

            bool wasCalled = false;

            var value = adapter.GetOrCreateValue(
                "test",
                s =>
            {
                Assert.That(wasCalled, Is.False);
                wasCalled = true;
                return(null);
            });

            Assert.That(value, Is.Null);

            value = adapter.GetOrCreateValue("test", s => { throw new InvalidOperationException("Must not be called."); });
            Assert.That(value, Is.Null);
        }
 public void SetUp()
 {
     _innerDataStoreMock = MockRepository.GenerateStrictMock <IDataStore <string, DoubleCheckedLockingContainer <Wrapper> > >();
     _store = new LazyLockingDataStoreAdapter <string, object> (_innerDataStoreMock);
 }
 private LockingDataStoreDecorator <string, DoubleCheckedLockingContainer <Wrapper> > GetLockingDataStoreDecorator(
     LazyLockingDataStoreAdapter <string, object> lazyLockingDataStoreAdapter)
 {
     return((LockingDataStoreDecorator <string, DoubleCheckedLockingContainer <Wrapper> >)
            PrivateInvoke.GetNonPublicField(lazyLockingDataStoreAdapter, "_innerDataStore"));
 }