コード例 #1
0
        public void GetViaKey()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.Equal(5, dataStore.Get(typeof(int).AssemblyQualifiedName));
            ApplicationStateMock.Verify(st => st.Get(typeof(int).AssemblyQualifiedName), Times.Once());
        }
コード例 #2
0
        public void SetViaKey()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            dataStore.Set("aKey", "thing");
            ApplicationStateMock.Verify(st => st.Set("aKey", "thing"), Times.Once());
        }
コード例 #3
0
        public void SetViaGenerics()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            dataStore.Set <int>(5);

            Assert.Equal(5, dataStore.Get <int>());
            ApplicationStateMock.Verify(st => st.Set(typeof(int).AssemblyQualifiedName, 5), Times.Once());
        }
コード例 #4
0
        public void GetViaGenericsWithKey()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            var result = dataStore.Get <int>(typeof(int).AssemblyQualifiedName);

            Assert.Equal(5, result);
            Assert.IsType <int>(result);
            ApplicationStateMock.Verify(st => st.Get(typeof(int).AssemblyQualifiedName), Times.Once());
        }
コード例 #5
0
        public void ConstructWithAnHttpApplicationStateBase()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.NotNull(dataStore);
        }
コード例 #6
0
        public void NotContainItems()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.False(dataStore.Contains("random key"));
        }
コード例 #7
0
        public void ContainItems()
        {
            var dataStore = new HttpApplicationStateBaseDataStoreAdapter(ApplicationStateMock.Object);

            Assert.True(dataStore.Contains(typeof(int).AssemblyQualifiedName));
        }