当前位置: 首页>>代码示例>>C#>>正文


C# PrivateType.GetStaticField方法代码示例

本文整理汇总了C#中PrivateType.GetStaticField方法的典型用法代码示例。如果您正苦于以下问题:C# PrivateType.GetStaticField方法的具体用法?C# PrivateType.GetStaticField怎么用?C# PrivateType.GetStaticField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PrivateType的用法示例。


在下文中一共展示了PrivateType.GetStaticField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init()
        {
            PrivateType p = new PrivateType(typeof(Dev2DataLanguageParser));
            var cache = p.GetStaticField("_expressionCache") as ConcurrentDictionary<string, IList<IIntellisenseResult>>;
            Assert.IsNotNull(cache);
            cache.Clear();
            var cache2 = p.GetStaticField("_payloadCache") as ConcurrentDictionary<Tuple<string, string>, IList<IIntellisenseResult>>;
            Assert.IsNotNull(cache2);
            cache2.Clear();
            Monitor.Enter(DataListSingletonTest.DataListSingletonTestGuard);

            var testEnvironmentModel = ResourceModelTest.CreateMockEnvironment();

            _resourceModel = new ResourceModel(testEnvironmentModel.Object)
            {
                ResourceName = "test",
                ResourceType = ResourceType.Service,
                DataList = @"
            <DataList>
                    <Scalar/>
                    <Country/>
                    <State />
                    <City>
                        <Name/>
                        <GeoLocation />
                    </City>
             </DataList>
            "
            };

            IDataListViewModel setupDatalist = new DataListViewModel();
            DataListSingleton.SetDataList(setupDatalist);
            DataListSingleton.ActiveDataList.InitializeDataListViewModel(_resourceModel);
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:34,代码来源:DefaultIntellisenseProviderTest.cs

示例2: CalculateCosineCoefficients_Test

        public void CalculateCosineCoefficients_Test()
        {
            PrivateType pt = new PrivateType(typeof(JpegImage));
            JpegImage ji = new JpegImage(new Bitmap(200, 100), 100, 4); //Constructor calls calcCosineCoef

            float[,] CosCoef = (float[,])pt.GetStaticField("CosinesCoefficients");

            float[,] ExpectedCosCoef = new float[8, 8]
            {
                {1f, 0.980785251f, 0.9238795f, 0.8314696f, 0.707106769f, 0.555570245f, 0.382683426f, 0.195090324f}, 
                {1f, 0.8314696f, 0.382683426f, -0.195090324f, -0.707106769f, -0.980785251f, -0.9238795f, -0.555570245f}, 
                {1f, 0.555570245f, -0.382683426f, -0.980785251f, -0.707106769f, 0.195090324f, 0.923879504f, 0.831469595f}, 
                {1f, 0.195090324f, -0.923879504f, -0.555570245f, 0.707106769f, 0.831469595f, -0.382683426f, -0.980785251f}, 
                {1f, -0.195090324f, -0.923879504f, 0.555570245f, 0.707106769f, -0.831469595f, -0.382683426f, 0.980785251f}, 
                {1f, -0.555570245f, -0.382683426f, 0.980785251f, -0.707106769f, -0.195090324f, 0.923879504f, -0.831469595f}, 
                {1f, -0.831469595f, 0.382683426f, 0.195090324f, -0.707106769f, 0.980785251f, -0.923879504f, 0.555570245f},
                {1f, -0.980785251f, 0.923879504f, -0.831469595f, 0.707106769f, -0.555570245f, 0.382683426f, -0.195090324f},
            };
           
            Assert.AreEqual(ExpectedCosCoef, CosCoef);
        }
开发者ID:hrjakobsen,项目名称:P2-AAU,代码行数:21,代码来源:JpegImageTests.cs

示例3: Dev2LanuageParser_Parse_IValid_ExpectNoCache

        public void Dev2LanuageParser_Parse_IValid_ExpectNoCache()
        {
            //------------Setup for test--------------------------
            const string dl = "<ADL><rec><val/></rec></ADL>";
            const string payload = "[[rec().val]]";
  
            PrivateType p = new PrivateType(typeof(Dev2DataLanguageParser));
            var cache = p.GetStaticField("_expressionCache") as ConcurrentDictionary<string, IList<IIntellisenseResult>>;
            Assert.IsNotNull(cache);
            cache.Clear();
            Assert.AreEqual(cache.Count, 0);
            ParseDataLanguageForIntellisense(payload, dl, true, false);
            Assert.IsNotNull(cache);
            Assert.AreEqual(cache.Count, 0);

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:19,代码来源:Dev2DataLanguageParserTest.cs

示例4: Dev2LanuageParser_Parse_Valid_ExpectCache

        public void Dev2LanuageParser_Parse_Valid_ExpectCache()
        {
            //------------Setup for test--------------------------
            PrivateType p = new PrivateType(typeof(Dev2DataLanguageParser));
            var cache = p.GetStaticField("_payloadCache") as ConcurrentDictionary<Tuple<string, string>, IList<IIntellisenseResult>>;
            if(cache != null)
            {
                cache.Clear();
            }
            const string dl = "<ADL><rec><val/></rec></ADL>";
            const string payload = "[[rec().val]]";
            var dev2LanuageParser = new Dev2DataLanguageParser();

            IList<IIntellisenseResult> results = ParseDataLanguageForIntellisense(payload, dl, true, false);
            Assert.IsNotNull(cache);
            Assert.AreEqual(cache.Count,1);
            

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:22,代码来源:Dev2DataLanguageParserTest.cs

示例5: Dev2LanuageParser_ParseExpressionIntoParts_WhenInValid_ExpectNoCache

        public void Dev2LanuageParser_ParseExpressionIntoParts_WhenInValid_ExpectNoCache()
        {
            //------------Setup for test--------------------------
            var dev2LanuageParser = new Dev2DataLanguageParser();
            PrivateType p = new PrivateType(typeof(Dev2DataLanguageParser));
            var cache = p.GetStaticField("_payloadCache") as ConcurrentDictionary<Tuple<string, string>, IList<IIntellisenseResult>>;

            Assert.IsNotNull(cache);
            cache.Clear();
            Assert.AreEqual(cache.Count, 0);
            const string data = @"[[rec(*123).a]]";
            const string dl = "<DataList><rec><a/></rec></DataList>";
            var compiler = DataListFactory.CreateDataListCompiler();
            ErrorResultTO errors;
            var dlID = compiler.ConvertTo(DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), string.Empty.ToStringBuilder(), dl.ToStringBuilder(), out errors);
            var bdl = compiler.FetchBinaryDataList(dlID, out errors);
            var intillisenseParts = bdl.FetchIntellisenseParts();
            //------------Execute Test---------------------------
            dev2LanuageParser.ParseExpressionIntoParts(data, intillisenseParts);
            //------------Assert Results-------------------------
            Assert.IsNotNull(cache);
            Assert.AreEqual(cache.Count, 0);


        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:25,代码来源:Dev2DataLanguageParserTest.cs


注:本文中的PrivateType.GetStaticField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。