Skip to content
This repository was archived by the owner on Dec 18, 2018. It is now read-only.

Commit e46c8b4

Browse files
committed
Fixed tests on mono
- Skipped encypted XML test on mono - Handle different error messages on mono (filed bugs)
1 parent a166a26 commit e46c8b4

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

test/Microsoft.Framework.ConfigurationModel.Test/EnvironmentVariablesConfigurationSourceTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ public void ThrowExceptionWhenKeyIsDuplicatedInAzureEnvironment()
109109
{"SQLCONNSTR_db2", "SQLConnStr"},
110110
};
111111
var envConfigSrc = new EnvironmentVariablesConfigurationSource();
112-
var expectedMsg = "An item with the same key has already been added.";
112+
113+
// On mono the exception message is different
114+
var isMono = Type.GetType("Mono.Runtime") != null;
115+
var expectedMsg = isMono ? "An element with the same key already exists in the dictionary." : "An item with the same key has already been added.";
113116

114117
var exception = Assert.Throws<ArgumentException>(() => envConfigSrc.Load(dict));
115118

test/Microsoft.Framework.ConfigurationModel.Xml.Test/XmlConfigurationSourceTest.AspNet50.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
using System.Security.Cryptography;
99
using System.Security.Cryptography.Xml;
1010
using System.Xml;
11+
using Microsoft.AspNet.Testing.xunit;
1112
using Xunit;
1213

1314
namespace Microsoft.Framework.ConfigurationModel
1415
{
1516
public partial class XmlConfigurationSourceTest
1617
{
17-
[Fact]
18+
[ConditionalFact]
19+
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
1820
public void LoadKeyValuePairsFromValidEncryptedXml()
1921
{
2022
var xml = @"

test/Microsoft.Framework.ConfigurationModel.Xml.Test/XmlConfigurationSourceTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ public void ThrowExceptionWhenFindDTD()
299299
</Data>
300300
</settings>";
301301
var xmlConfigSrc = new XmlConfigurationSource(ArbitraryFilePath);
302-
var expectedMsg = "For security reasons DTD is prohibited in this XML document. "
302+
var isMono = Type.GetType("Mono.Runtime") != null;
303+
var expectedMsg = isMono ? "Document Type Declaration (DTD) is prohibited in this XML. Line 1, position 10." : "For security reasons DTD is prohibited in this XML document. "
303304
+ "To enable DTD processing set the DtdProcessing property on XmlReaderSettings "
304305
+ "to Parse and pass the settings into XmlReader.Create method.";
305306

test/Microsoft.Framework.ConfigurationModel.Xml.Test/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"dependencies": {
33
"Microsoft.Framework.ConfigurationModel.Xml": "1.0.0-*",
44
"Microsoft.Framework.ConfigurationModel.Test.Common": "1.0.0-*",
5+
"Microsoft.AspNet.Testing": "1.0.0-*",
56
"xunit.runner.aspnet": "2.0.0-aspnet-*"
67
},
78
"frameworks": {

0 commit comments

Comments
 (0)