本文整理汇总了C#中EvaluationEngine.Evaluate方法的典型用法代码示例。如果您正苦于以下问题:C# EvaluationEngine.Evaluate方法的具体用法?C# EvaluationEngine.Evaluate怎么用?C# EvaluationEngine.Evaluate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EvaluationEngine
的用法示例。
在下文中一共展示了EvaluationEngine.Evaluate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IID002
public void IID002()
{
string[] files = new string[] { "2.IID002Policy.xml", "2.IID002Request.xml", "2.IID002Response.xml" };
Assert.AreEqual(files.Length, 3); FileInfo policyFile = new FileInfo(Consts.Path + files[0]);
FileInfo requestFile = new FileInfo(Consts.Path + files[1]);
FileInfo ResponseElementFile = new FileInfo(Consts.Path + files[2]);
using (FileStream fs = new FileStream(policyFile.FullName, FileMode.Open, FileAccess.Read))
using (FileStream fs1 = new FileStream(requestFile.FullName, FileMode.Open, FileAccess.Read))
using (FileStream fs2 = new FileStream(ResponseElementFile.FullName, FileMode.Open, FileAccess.Read))
{
// Load Policy
PolicyDocument policyDocument = (PolicyDocument)PolicyLoader.LoadPolicyDocument(fs, XacmlVersion.Version20, DocumentAccess.ReadOnly);
// Load Request
ContextDocumentReadWrite requestDocument = ContextLoader.LoadContextDocument(fs1, XacmlVersion.Version20);
// Load ResponseElement
ContextDocumentReadWrite ResponseElementDocument = ContextLoader.LoadContextDocument(fs2, XacmlVersion.Version20);
EvaluationEngine engine = new EvaluationEngine();
ResponseElement res = engine.Evaluate(policyDocument, (ContextDocument)requestDocument);
Assert.AreEqual(((ResultElement)res.Results[0]).Obligations.Count, ((ResultElement)ResponseElementDocument.Response.Results[0]).Obligations.Count);
Assert.AreEqual(ResponseElementDocument.Response.Results.Count, res.Results.Count);
Assert.IsTrue(((ResultElement)res.Results[0]).Decision.ToString() == ((ResultElement)ResponseElementDocument.Response.Results[0]).Decision.ToString(), string.Format("Decission incorrect Expected:{0} Returned:{1}", ((ResultElement)ResponseElementDocument.Response.Results[0]).Decision.ToString(), ((ResultElement)res.Results[0]).Decision.ToString()));
Assert.IsTrue(((ResultElement)res.Results[0]).Status.StatusCode.Value == ((ResultElement)ResponseElementDocument.Response.Results[0]).Status.StatusCode.Value, String.Format("Status incorrect Expected:{0} Returned:{1}", ((ResultElement)ResponseElementDocument.Response.Results[0]).Status.StatusCode.Value, ((ResultElement)res.Results[0]).Status.StatusCode.Value));
}
}