/// <summary> /// A method is used to generate a single ct_netzone type instance for current test client according to the netZoneType. /// </summary> /// <param name="netZoneType">A parameter represents the netZone type, it can only be set to "st_wopizone.internalhttp" or "st_wopizone.internalhttps"</param> /// <param name="currentTestClientName">A parameter represents the current test client name which run the test suite. This value is used to generated the WOPI client's app name.</param> /// <param name="fakedWOPIClientActionHostName">A parameter represents the host name for the action of the WOPI client support.</param> /// <returns>A return value represents the ct_netzone type instance.</returns> private static ct_netzone GetSingleNetZoneForWopiDiscoveryResponse(st_wopizone netZoneType, string currentTestClientName, string fakedWOPIClientActionHostName) { string transportValue = st_wopizone.internalhttp == netZoneType ? Uri.UriSchemeHttp : Uri.UriSchemeHttps; Random radomInstance = new Random((int)DateTime.UtcNow.Ticks & 0x0000FFFF); string appName = string.Format( @"MSWOPITESTAPP {0} _for {1} WOPIServer_{2}", radomInstance.Next(), currentTestClientName, netZoneType); Uri favIconUrlValue = new Uri( string.Format(@"{0}://{1}/wv/resources/1033/FavIcon_Word.ico", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); Uri urlsrcValueOfTextFile = new Uri( string.Format(@"{0}://{1}/wv/wordviewerframe.aspx?<ui=UI_LLCC&><rs=DC_LLCC&><showpagestats=PERFSTATS&>", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); Uri urlsrcValueOfZipFile = new Uri( string.Format(@"{0}://{1}/wv/zipviewerframe.aspx?<ui=UI_LLCC&><rs=DC_LLCC&><showpagestats=PERFSTATS&>", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); Uri urlsrcValueOfUsingprogid = new Uri( string.Format(@"{0}://{1}/o/onenoteframe.aspx?edit=0&<ui=UI_LLCC&><rs=DC_LLCC&><showpagestats=PERFSTATS&>", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); // Setting netZone's sub element's values ct_appname appElement = new ct_appname(); appElement.name = appName; appElement.favIconUrl = favIconUrlValue.OriginalString; appElement.checkLicense = true; // Action element for txt file ct_wopiaction actionForTextFile = new ct_wopiaction(); actionForTextFile.name = st_wopiactionvalues.view; actionForTextFile.ext = "txt"; actionForTextFile.requires = "containers"; actionForTextFile.@default = true; actionForTextFile.urlsrc = urlsrcValueOfTextFile.OriginalString; // Action element for txt file ct_wopiaction formeditactionForTextFile = new ct_wopiaction(); formeditactionForTextFile.name = st_wopiactionvalues.formedit; formeditactionForTextFile.ext = "txt"; formeditactionForTextFile.@default = true; formeditactionForTextFile.urlsrc = urlsrcValueOfTextFile.OriginalString; ct_wopiaction formViewactionForTextFile = new ct_wopiaction(); formViewactionForTextFile.name = st_wopiactionvalues.formsubmit; formViewactionForTextFile.ext = "txt"; formViewactionForTextFile.@default = true; formViewactionForTextFile.urlsrc = urlsrcValueOfTextFile.OriginalString; // Action element for zip file ct_wopiaction actionForZipFile = new ct_wopiaction(); actionForZipFile.name = st_wopiactionvalues.view; actionForZipFile.ext = "zip"; actionForZipFile.@default = true; actionForZipFile.urlsrc = urlsrcValueOfZipFile.OriginalString; // Action elements for one note. ct_wopiaction actionForOneNote = new ct_wopiaction(); actionForOneNote.name = st_wopiactionvalues.view; actionForOneNote.ext = "one"; actionForOneNote.requires = "cobalt"; actionForOneNote.@default = true; actionForOneNote.urlsrc = urlsrcValueOfUsingprogid.OriginalString; // Action elements for one note. ct_wopiaction actionForOneNoteProg = new ct_wopiaction(); actionForOneNoteProg.name = st_wopiactionvalues.view; actionForOneNoteProg.progid = progIdValue; actionForOneNoteProg.requires = "cobalt,containers"; actionForOneNoteProg.@default = true; actionForOneNoteProg.urlsrc = urlsrcValueOfUsingprogid.OriginalString; // Add action elements into the app element. appElement.action = new ct_wopiaction[] { actionForTextFile, actionForOneNote, actionForZipFile, formeditactionForTextFile, formViewactionForTextFile, actionForOneNoteProg }; // Add app element into the netzone element. ct_netzone netZoneInstance = new ct_netzone(); netZoneInstance.app = new ct_appname[] { appElement }; netZoneInstance.name = netZoneType; netZoneInstance.nameSpecified = true; return(netZoneInstance); }
/// <summary> /// A method is used to generate a single ct_netzone type instance for current test client according to the netZoneType. /// </summary> /// <param name="netZoneType">A parameter represents the netZone type, it can only be set to "st_wopizone.internalhttp" or "st_wopizone.internalhttps"</param> /// <param name="currentTestClientName">A parameter represents the current test client name which run the test suite. This value is used to generated the WOPI client's app name.</param> /// <param name="fakedWOPIClientActionHostName">A parameter represents the host name for the action of the WOPI client support.</param> /// <returns>A return value represents the ct_netzone type instance.</returns> private static ct_netzone GetSingleNetZoneForWopiDiscoveryResponse(st_wopizone netZoneType, string currentTestClientName, string fakedWOPIClientActionHostName) { string transportValue = st_wopizone.internalhttp == netZoneType ? Uri.UriSchemeHttp : Uri.UriSchemeHttps; Random radomInstance = new Random((int)DateTime.UtcNow.Ticks & 0x0000FFFF); string appName = string.Format( @"MSWOPITESTAPP {0} _for {1} WOPIServer_{2}", radomInstance.Next(), currentTestClientName, netZoneType); Uri favIconUrlValue = new Uri( string.Format(@"{0}://{1}/wv/resources/1033/FavIcon_Word.ico", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); Uri urlsrcValueOfTextFile = new Uri( string.Format(@"{0}://{1}/wv/wordviewerframe.aspx?<ui=UI_LLCC&><rs=DC_LLCC&><showpagestats=PERFSTATS&>", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); Uri urlsrcValueOfZipFile = new Uri( string.Format(@"{0}://{1}/wv/zipviewerframe.aspx?<ui=UI_LLCC&><rs=DC_LLCC&><showpagestats=PERFSTATS&>", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); Uri urlsrcValueOfUsingprogid = new Uri( string.Format(@"{0}://{1}/o/onenoteframe.aspx?edit=0&<ui=UI_LLCC&><rs=DC_LLCC&><showpagestats=PERFSTATS&>", transportValue, fakedWOPIClientActionHostName), UriKind.Absolute); // Setting netZone's sub element's values ct_appname appElement = new ct_appname(); appElement.name = appName; appElement.favIconUrl = favIconUrlValue.OriginalString; appElement.checkLicense = true; // Action element for txt file ct_wopiaction actionForTextFile = new ct_wopiaction(); actionForTextFile.name = st_wopiactionvalues.view; actionForTextFile.ext = "txt"; actionForTextFile.requires = "containers"; actionForTextFile.@default = true; actionForTextFile.urlsrc = urlsrcValueOfTextFile.OriginalString; // Action element for txt file ct_wopiaction formeditactionForTextFile = new ct_wopiaction(); formeditactionForTextFile.name = st_wopiactionvalues.formedit; formeditactionForTextFile.ext = "txt"; formeditactionForTextFile.@default = true; formeditactionForTextFile.urlsrc = urlsrcValueOfTextFile.OriginalString; ct_wopiaction formViewactionForTextFile = new ct_wopiaction(); formViewactionForTextFile.name = st_wopiactionvalues.formsubmit; formViewactionForTextFile.ext = "txt"; formViewactionForTextFile.@default = true; formViewactionForTextFile.urlsrc = urlsrcValueOfTextFile.OriginalString; // Action element for zip file ct_wopiaction actionForZipFile = new ct_wopiaction(); actionForZipFile.name = st_wopiactionvalues.view; actionForZipFile.ext = "zip"; actionForZipFile.@default = true; actionForZipFile.urlsrc = urlsrcValueOfZipFile.OriginalString; // Action elements for one note. ct_wopiaction actionForOneNote = new ct_wopiaction(); actionForOneNote.name = st_wopiactionvalues.view; actionForOneNote.ext = "one"; actionForOneNote.requires = "cobalt"; actionForOneNote.@default = true; actionForOneNote.urlsrc = urlsrcValueOfUsingprogid.OriginalString; // Action elements for one note. ct_wopiaction actionForOneNoteProg = new ct_wopiaction(); actionForOneNoteProg.name = st_wopiactionvalues.view; actionForOneNoteProg.progid = progIdValue; actionForOneNoteProg.requires = "cobalt,containers"; actionForOneNoteProg.@default = true; actionForOneNoteProg.urlsrc = urlsrcValueOfUsingprogid.OriginalString; // Add action elements into the app element. appElement.action = new ct_wopiaction[] { actionForTextFile, actionForOneNote, actionForZipFile, formeditactionForTextFile, formViewactionForTextFile, actionForOneNoteProg }; // Add app element into the netzone element. ct_netzone netZoneInstance = new ct_netzone(); netZoneInstance.app = new ct_appname[] { appElement }; netZoneInstance.name = netZoneType; netZoneInstance.nameSpecified = true; return netZoneInstance; }