From c302ed3946d124748ac3081c53512479fb050ed8 Mon Sep 17 00:00:00 2001 From: Anjali Date: Thu, 7 Dec 2023 13:33:05 +0530 Subject: [PATCH 1/3] Test updated for GetXmlNamespaceMaps and SetXmlNamespaceMaps --- .../MethodTests/XmlContent/XmlHandlingTest.cs | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs b/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs index 67806a213..6ef6b8340 100644 --- a/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs +++ b/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs @@ -210,34 +210,29 @@ public void VerifyXmlAttributeProperties() // GetXmlNamespaceMaps(DependencyObject dependencyObject) // SetXmlNamespaceMaps(DependencyObject dependencyObject, string value) // - // NOTE: These methods are broken and won't be fixed. We're just calling - // them to keep them off the radar. The exception verification will - // alert us if the implementation is ever fixed. - // - Exception ex = null; - try - { - XmlAttributeProperties.SetXmlNamespaceMaps(dobj, "foo"); - } - catch (Exception e) - { - ex = e; - } - if (ex == null) throw new Microsoft.Test.TestValidationException("FAILED"); - ex = null; try { - XmlAttributeProperties.GetXmlNamespaceMaps(dobj); + //Pass null to both dependencyObject and value in SetXmlNamespaceMaps, this will throw exception + XmlAttributeProperties.SetXmlNamespaceMaps(null, null); + + //Pass null to dependencyObject in GetXmlNamespaceMaps, this will throw exception + XmlAttributeProperties.GetXmlNamespaceMaps(null); } catch (Exception e) { - ex = e; + e.ToString().Contains("dependencyObject"); } - - if (ex == null) throw new Microsoft.Test.TestValidationException("FAILED"); + + //Pass value in SetXmlNamespaceMaps, then verify if the value is set correctly by GetXmlNamespaceMaps + Hashtable hashtable = new Hashtable(); + hashtable.Add("a1", "foo"); + XmlAttributeProperties.SetXmlNamespaceMaps(dobj, hashtable); + var xmlNamespaceMapsvalue = XmlAttributeProperties.GetXmlNamespaceMaps(dobj); + //_IsStringEqual("foo", xmlNamespaceMapsvalue["a1"]); } - // Checks that 2 string values are equalivalent. + + // Checks that 2 string values are equivalent. private static void _IsStringEqual(string expected, string actual) { if (actual == null) From b4118bb1b89c0592af5907c057dd36abc74f0c10 Mon Sep 17 00:00:00 2001 From: Anjali Date: Tue, 30 Jan 2024 10:39:53 +0530 Subject: [PATCH 2/3] Added condition checks for GetXmlNamespaceMaps and SetXmlNamespaceMaps apis --- .../MethodTests/XmlContent/XmlHandlingTest.cs | 45 ++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs b/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs index 6ef6b8340..8bdee91ed 100644 --- a/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs +++ b/src/Test/XAML/FeatureTests/XamlTests35/Microsoft/Test/Xaml/Parser/MethodTests/XmlContent/XmlHandlingTest.cs @@ -14,6 +14,7 @@ using System.Windows.Threading; using Microsoft.Test.Serialization; using System.Windows.Media; +using Microsoft.Test.Logging; using Microsoft.Test.Discovery; using Microsoft.Test.Xaml.Utilities; @@ -215,21 +216,51 @@ public void VerifyXmlAttributeProperties() { //Pass null to both dependencyObject and value in SetXmlNamespaceMaps, this will throw exception XmlAttributeProperties.SetXmlNamespaceMaps(null, null); - + } + catch (Exception e) + { + GlobalLog.LogStatus("Exception is expected. Exception in SetXmlNamespaceMaps : " + e.ToString()); + } + + try + { //Pass null to dependencyObject in GetXmlNamespaceMaps, this will throw exception XmlAttributeProperties.GetXmlNamespaceMaps(null); } catch (Exception e) { - e.ToString().Contains("dependencyObject"); + GlobalLog.LogStatus("Exception is expected. Exception in GetXmlNamespaceMaps : " + e.ToString()); } //Pass value in SetXmlNamespaceMaps, then verify if the value is set correctly by GetXmlNamespaceMaps - Hashtable hashtable = new Hashtable(); - hashtable.Add("a1", "foo"); - XmlAttributeProperties.SetXmlNamespaceMaps(dobj, hashtable); - var xmlNamespaceMapsvalue = XmlAttributeProperties.GetXmlNamespaceMaps(dobj); - //_IsStringEqual("foo", xmlNamespaceMapsvalue["a1"]); + + DependencyObject dObj = new DependencyObject(); + Hashtable hashTable = new Hashtable(); + var hashTableKey = "dummyKey"; + var hashTableValue = "dummyValue"; + hashTable.Add(hashTableKey, hashTableValue); + XmlAttributeProperties.SetXmlNamespaceMaps(dObj, hashTable); + var xmlNamespaceMapsValue = XmlAttributeProperties.GetXmlNamespaceMaps(dObj); + + if (xmlNamespaceMapsValue.GetType() == typeof(Hashtable)) + { + foreach (DictionaryEntry entry in xmlNamespaceMapsValue) + { + _IsStringEqual(entry.Key.ToString(), hashTableKey); + if (entry.Value != null) + { + _IsStringEqual(entry.Value.ToString(), hashTableValue); + } + else + { + throw new Microsoft.Test.TestValidationException("Value is unexpected. Expected:" + hashTableValue + ", Actual:null"); + } + } + } + else + { + throw new Microsoft.Test.TestValidationException("Value is unexpected. Expected:" + typeof(Hashtable) + ", Actual:" + xmlNamespaceMapsValue.GetType()); + } } // Checks that 2 string values are equivalent. From 0a4ce28439ebfaf39fd13e47a52cdc13c0ac2ee7 Mon Sep 17 00:00:00 2001 From: Anjali Date: Thu, 23 May 2024 01:14:06 +0530 Subject: [PATCH 3/3] Updated net version to target 9.0 and suppressed error SYSLIB0009 --- .../DigitalDocuments/DRT/Core/PackScheme/DrtPackScheme.cs | 4 ++-- src/Test/Directory.Build.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Test/DigitalDocuments/DRT/Core/PackScheme/DrtPackScheme.cs b/src/Test/DigitalDocuments/DRT/Core/PackScheme/DrtPackScheme.cs index 23e083db4..036425423 100644 --- a/src/Test/DigitalDocuments/DRT/Core/PackScheme/DrtPackScheme.cs +++ b/src/Test/DigitalDocuments/DRT/Core/PackScheme/DrtPackScheme.cs @@ -176,8 +176,9 @@ public void RegisterScheme() // Register our scheme with WebRequest Console.WriteLine("Register PACK scheme with WebRequest"); DRT.Assert(WebRequest.RegisterPrefix("pack", new PackWebRequestFactory()), "RegisterPrefix failed"); +#pragma warning disable SYSLIB0009 // Type or member is obsolete AuthenticationManager.CredentialPolicy = new Microsoft.Win32.IntranetZoneCredentialPolicy(); - +#pragma warning restore SYSLIB0009 // Type or member is obsolete } public void EnsureContainer() @@ -957,4 +958,3 @@ private void DumpRequest(WebRequest request) } } } - diff --git a/src/Test/Directory.Build.props b/src/Test/Directory.Build.props index 5250a7b60..e64103cdb 100644 --- a/src/Test/Directory.Build.props +++ b/src/Test/Directory.Build.props @@ -3,7 +3,7 @@ false - net8.0-windows + net9.0-windows AnyCPU;x64 win-x64;win-x86 true