コード例 #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 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());
        }
コード例 #3
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());
        }