コード例 #1
0
        private IDescriptorsCache MockNHibernateCallsAndInitializeCache()
        {
            MockDescriptorCacheDataProvider = A.Fake <IDescriptorLookupProvider>();

            A.CallTo(() => MockDescriptorCacheDataProvider.GetAllDescriptorLookups())
            .Returns(
                new Dictionary <string, IList <DescriptorLookup> >
            {
                {
                    TestDescriptorName, new List <DescriptorLookup>
                    {
                        TestDescriptorNormal,
                        TestDescriptorCustom,
                        TestDescriptorWithCodeValue
                    }
                }
            });

            Dictionary <string, IList <DescriptorLookup> > values = new Dictionary <string, IList <DescriptorLookup> >
            {
                {
                    TestDescriptorName, new List <DescriptorLookup>
                    {
                        TestDescriptorNormal,
                        TestDescriptorCustom,
                        TestDescriptorWithCodeValue
                    }
                }
            };

            var memorycacheoption = A.Fake <IOptions <MemoryCacheOptions> >();

            MemoryCache memoryCache = new MemoryCache(memorycacheoption);

            CacheProvider = new MemoryCacheProvider(memoryCache);
            CacheProvider.Insert(TestDescriptorName, values, DateTime.MaxValue, TimeSpan.FromMinutes(5));

            MockEdFiOdsInstanceIdentificationProvider =
                A.Fake <IEdFiOdsInstanceIdentificationProvider>();

            A.CallTo(() => MockEdFiOdsInstanceIdentificationProvider.GetInstanceIdentification())
            .Returns(1);

            descriptionCache = new DescriptorsCache(
                MockDescriptorCacheDataProvider, CacheProvider, MockEdFiOdsInstanceIdentificationProvider);
            return(descriptionCache);
        }
コード例 #2
0
 private string GetUsiKeyTokenContext()
 {
     return(string.Format("from_{0}", _edFiOdsInstanceIdentificationProvider.GetInstanceIdentification()));
 }