本文整理汇总了C#中ContainerBuilder.CreateContainerFromUro方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerBuilder.CreateContainerFromUro方法的具体用法?C# ContainerBuilder.CreateContainerFromUro怎么用?C# ContainerBuilder.CreateContainerFromUro使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder.CreateContainerFromUro方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_02_CreateContainerFromUroRemovableDeviceRootFolder
public void Test_02_CreateContainerFromUroRemovableDeviceRootFolder()
{
IContainer container;
PolicyResponseObject pro = ProHelper.GeneratePRO(null, PolicyType.ClientRemovableMedia, out container);
Assert.IsNotNull(pro);
Assert.IsNotNull(pro.ContentCollection);
Assert.IsNotNull(container);
string[] files = new string[]
{
Path.Combine(TEST_FOLDER, "TestProfanity.doc"),
Path.Combine(TEST_FOLDER, "small.xls"),
Path.Combine(TEST_FOLDER, "TestDoc.ppt")
};
TestHelpers.AddFilesToRemovableDeviceRoot(pro.UniversalRequestObject, files);
ContainerBuilder containerBuilder = new ContainerBuilder(pro);
container = containerBuilder.CreateContainerFromUro();
Assert.AreEqual(FileType.Selection, (container as File).FileType);
Assert.AreEqual(1, container.Files.Count);
Assert.AreEqual(3, container.Files[0].Files.Count);
Assert.AreEqual(4, pro.ContentCollection.Count);
ContentItem contentItemParent = pro.ContentCollection[0] as ContentItem;
Assert.AreEqual(FileType.Folder, contentItemParent.File.FileType);
Assert.IsNull(contentItemParent.Parent);
ContentItem contentItem = pro.ContentCollection[1] as ContentItem;
Assert.AreEqual(FileType.WordDocument, contentItem.File.FileType);
Assert.IsNotNull(contentItem.Parent);
Assert.AreEqual(contentItem.Parent.Name, contentItemParent.Name);
contentItem = pro.ContentCollection[2] as ContentItem;
Assert.AreEqual(FileType.ExcelSheet, contentItem.File.FileType);
Assert.IsNotNull(contentItem.Parent);
Assert.AreEqual(contentItem.Parent.Name, contentItemParent.Name);
contentItem = pro.ContentCollection[3] as ContentItem;
Assert.AreEqual(FileType.PowerPoint, contentItem.File.FileType);
Assert.IsNotNull(contentItem.Parent);
Assert.AreEqual(contentItem.Parent.Name, contentItemParent.Name);
}
示例2: GeneratePRO
public static PolicyResponseObject GeneratePRO(string[] files, PolicyType policyType, out IContainer container)
{
PolicyResponseObject pro = new PolicyResponseObject();
pro.RunAt = RunAt.Client;
UniversalRequestObject uro = new UniversalRequestObject();
uro.PolicyType = policyType;
uro.DataTimeStamp = DateTime.Now;
GenerateURORoutingDetails(uro, policyType);
GenerateUROProperties(uro, policyType);
GenerateUROAttachmentData(uro, files);
pro.UniversalRequestObject = uro;
ContainerBuilder containerBuilder = new ContainerBuilder(pro);
container = containerBuilder.CreateContainerFromUro();
return pro;
}
示例3: Test_07_CreateContainerFromNetMonChannelAsHTTPType
public void Test_07_CreateContainerFromNetMonChannelAsHTTPType()
{
string[] attachments = new string[]
{
Path.Combine(TEST_FOLDER, "TestProfanity.doc"),
Path.Combine(TEST_FOLDER, "small.xls"),
Path.Combine(TEST_FOLDER, "TestDoc.ppt")
};
PolicyResponseObject pro = new PolicyResponseObject();
pro.RunAt = RunAt.Client;
UniversalRequestObject uro = new UniversalRequestObject();
uro.PolicyType = PolicyType.NetMon;
uro.DataTimeStamp = DateTime.Now;
uro.Properties[HttpRequestPropertyKeys.Description] = "stuff";
uro.Properties["tag1"] = "This is a test";
uro.Properties["tag2"] = "This is a test";
ProHelper.GenerateUROAttachmentData(uro, attachments);
pro.UniversalRequestObject = uro;
ContainerBuilder containerBuilder = new ContainerBuilder(pro);
IContainer container = containerBuilder.CreateContainerFromUro();
Assert.IsTrue(container.DisplayName == "HTTP Content");
}
示例4: Test_06_CreateContainerFromNetMonChannelAsEmailType
public void Test_06_CreateContainerFromNetMonChannelAsEmailType()
{
string[] attachments = new string[]
{
Path.Combine(TEST_FOLDER, "TestProfanity.doc"),
Path.Combine(TEST_FOLDER, "small.xls"),
Path.Combine(TEST_FOLDER, "TestDoc.ppt")
};
PolicyResponseObject pro = new PolicyResponseObject();
pro.RunAt = RunAt.Client;
UniversalRequestObject uro = new UniversalRequestObject();
uro.PolicyType = PolicyType.NetMon;
uro.DataTimeStamp = DateTime.Now;
ProHelper.GenerateUROProperties(uro, PolicyType.NetMon);
ProHelper.GenerateUROAttachmentData(uro, attachments);
pro.UniversalRequestObject = uro;
ContainerBuilder containerBuilder = new ContainerBuilder(pro);
IContainer container = containerBuilder.CreateContainerFromUro();
Assert.IsTrue(container.DisplayName == "message subject/body");
}
示例5: AddFiles
internal static void AddFiles(PolicyResponseObject pro, out IContainer container)
{
if ((null == pro) || (null == pro.UniversalRequestObject) || (null == pro.UniversalRequestObject.Attachments))
{
container = null;
return;
}
ContainerBuilder containerBuilder = new ContainerBuilder(pro);
container = containerBuilder.CreateContainerFromUro() as IContainer;
}
示例6: InitialisePro
private void InitialisePro(PolicyResponseObject pro, IUniversalRequestObject uro)
{
pro.RunAt = m_runAt;
pro.UniversalRequestObject = uro;
pro.PolicyType = uro.PolicyType;
pro.ChannelDetail = uro.Properties.ContainsKey("RequestChannel") ? uro.Properties["RequestChannel"] : "";
RoutingInfoHelper.PopulateRoutingInfo(pro);
ContainerBuilder containerBuilder = new ContainerBuilder(pro);
containerBuilder.CreateContainerFromUro();
}
示例7: HandleContent
private static IContainer HandleContent(PolicyResponseObject proOut, Response responseIn)
{
ContainerBuilder containerBuilder = new ContainerBuilder(proOut);
IContainer retVal = containerBuilder.CreateContainerFromUro();
AssignContentIds(responseIn, proOut.ContentCollection);
//We now have a populated content collection, with the correct container structure.
//Next, associate policy with the new content collection.
Dictionary<string, Workshare.PolicyContent.ContentItem> contentItemLookup = new Dictionary<string, Workshare.PolicyContent.ContentItem>();
foreach (Workshare.PolicyContent.ContentItem item in responseIn.Contents)
{
contentItemLookup[item.Id] = item;
//This just gives us an indexer into the Response content items.
}
foreach (IContentItem item in proOut.ContentCollection)
{
Workshare.Policy.Engine.ContentItem contentItem =
item as Workshare.Policy.Engine.ContentItem;
Debug.Assert(contentItemLookup.ContainsKey(contentItem.File.ContentId));
PolicySet[] policySets = contentItemLookup[contentItem.File.ContentId].PolicySets;
foreach (PolicySet set in policySets)
{
item.PolicySetCollection.Add( PolicySetAdaptor.GetIPolicySetResponse(set) );
}
}
return retVal;
}