Skip to content

Commit

Permalink
[Wasm] Enable System.Data.Common tests (dotnet#39463)
Browse files Browse the repository at this point in the history
Disable the tests that require SQL Server.

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Maxim Lipnin <v-maxlip@microsoft.com>
  • Loading branch information
3 people authored and Jacksondr5 committed Aug 10, 2020
1 parent f74e64a commit 8bcef22
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public sealed class TestProviderFactory : DbProviderFactory
private TestProviderFactory() { }
}

[PlatformSpecific(~TestPlatforms.Browser)]
public class DbProviderFactoriesTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace System.Data.Tests.Common
{
[PlatformSpecific(~TestPlatforms.Browser)]
public class DbProviderFactoryTest
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1894,7 +1894,7 @@ public void IsNull_ByIndex()
Assert.True(dr.IsNull(1));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void IsNull_ByName()
{
DataTable dt = new DataTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void SimpleElementTable()
DataSetAssertion.AssertDataColumn("col3", dt.Columns[2], "col3", true, false, 0, 1, "col3", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 2, string.Empty, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void SimpleDataSet()
{
DataSet ds = GetDataSet(_xml8, null);
Expand Down Expand Up @@ -337,7 +337,7 @@ public void SignificantWhitespaceIgnored2()
DataSetAssertion.AssertDataSet("pure_whitespace", ds, "root", 0, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TwoElementTable()
{
// FIXME: Also test ReadXml (, XmlReadMode.InferSchema) and
Expand All @@ -356,7 +356,7 @@ public void TwoElementTable()
DataSetAssertion.AssertDataColumn("col2_2", dt.Columns[1], "col2_2", true, false, 0, 1, "col2_2", MappingType.Element, typeof(string), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ConflictSimpleComplexColumns()
{
DataSet ds = GetDataSet(_xml18, null);
Expand All @@ -377,7 +377,7 @@ public void ConflictSimpleComplexColumns()
DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" });
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ConflictColumnTable()
{
DataSet ds = GetDataSet(_xml19, null);
Expand All @@ -398,7 +398,7 @@ public void ConflictColumnTable()
DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" });
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ConflictColumnTableAttribute()
{
// Conflicts between a column and a table, additionally an attribute.
Expand All @@ -421,7 +421,7 @@ public void ConflictColumnTableAttribute()
DataSetAssertion.AssertForeignKeyConstraint("fkey", dr.ChildKeyConstraint, "table_col", AcceptRejectRule.None, Rule.Cascade, Rule.Cascade, new string[] { "table_Id" }, new string[] { "table_Id" });
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ConflictAttributeDataTable()
{
Assert.Throws<DataException>(() =>
Expand All @@ -433,7 +433,7 @@ public void ConflictAttributeDataTable()
});
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ConflictExistingPrimaryKey()
{
Assert.Throws<ConstraintException>(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private DataSet CreateTestSet()
return ds;
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void SingleElementTreatmentDifference()
{
// This is one of the most complicated case. When the content
Expand Down Expand Up @@ -149,7 +149,7 @@ public void SingleElementTreatmentDifference()
DataSetAssertion.AssertDataTable("complex", ds.Tables[0], "Root", 1, 0, 0, 0, 0, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void SuspiciousDataSetElement()
{
string schema = @"<?xml version='1.0'?>
Expand All @@ -174,7 +174,7 @@ public void SuspiciousDataSetElement()
DataSetAssertion.AssertDataTable("table", ds.Tables[0], "elem", 2, 0, 0, 0, 0, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void UnusedComplexTypesIgnored()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' id='hoge'>
Expand Down Expand Up @@ -213,7 +213,7 @@ public void SimpleTypeComponentsIgnored()
DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 0, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void IsDataSetAndTypeIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
Expand Down Expand Up @@ -243,7 +243,7 @@ public void IsDataSetAndTypeIgnored()
DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void NestedReferenceNotAllowed()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
Expand Down Expand Up @@ -272,7 +272,7 @@ public void NestedReferenceNotAllowed()
});
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void IsDataSetOnLocalElementIgnored()
{
string xsbase = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'>
Expand All @@ -294,7 +294,7 @@ public void IsDataSetOnLocalElementIgnored()
DataSetAssertion.AssertDataSet("ds", ds, "NewDataSet", 1, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void LocaleOnRootWithoutIsDataSet()
{
using (new ThreadCultureChange("fi-FI"))
Expand Down Expand Up @@ -323,7 +323,7 @@ public void LocaleOnRootWithoutIsDataSet()
}


[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ElementHasIdentityConstraint()
{
string constraints = @"
Expand Down Expand Up @@ -381,7 +381,7 @@ public void ElementHasIdentityConstraint()
Assert.Equal(0, ds.Relations.Count);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void PrefixedTargetNS()
{
string xs = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:msdata='urn:schemas-microsoft-com:xml-msdata' xmlns:x='urn:foo' targetNamespace='urn:foo' elementFormDefault='qualified'>
Expand Down Expand Up @@ -477,7 +477,7 @@ private void ReadTest1Check(DataSet ds)
new string[] { "Column1_3" });
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
// 001-004
public void TestSampleFileNoTables()
{
Expand Down Expand Up @@ -510,7 +510,7 @@ public void TestSampleFileNoTables()
DataSetAssertion.AssertDataSet("004", ds, "NewDataSet", 0, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestSampleFileSimpleTables()
{
var ds = new DataSet();
Expand Down Expand Up @@ -547,7 +547,7 @@ public void TestSampleFileSimpleTables()
DataSetAssertion.AssertDataColumn("att2", dt.Columns["att2"], "att2", true, false, 0, 1, "att2", MappingType.Attribute, typeof(int), 2, string.Empty, -1, string.Empty, /*1*/-1, string.Empty, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestSampleFileComplexTables()
{
// Nested simple type element
Expand Down Expand Up @@ -608,7 +608,7 @@ public void TestSampleFileComplexTables()
DataSetAssertion.AssertDataColumn("id", dt.Columns[1], "uno_Id", true, false, 0, 1, "uno_Id", MappingType.Hidden, typeof(int), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestSampleFileComplexTables3()
{
var ds = new DataSet();
Expand Down Expand Up @@ -639,7 +639,7 @@ public void TestSampleFileComplexTables3()
DataSetAssertion.AssertDataColumn("simple", dt.Columns[1], "e_text", false, false, 0, 1, "e_text", MappingType.SimpleContent, typeof(decimal), DBNull.Value, string.Empty, -1, string.Empty, 1, string.Empty, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestSampleFileXPath()
{
var ds = new DataSet();
Expand Down Expand Up @@ -681,7 +681,7 @@ public void TestSampleFileXPath()
</xs:schema>"));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestAnnotatedRelation1()
{
var ds = new DataSet();
Expand Down Expand Up @@ -732,7 +732,7 @@ public void TestAnnotatedRelation1()
DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "rel", false, new string[] { "pk" }, new string[] { "fk" }, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestAnnotatedRelation2()
{
var ds = new DataSet();
Expand Down Expand Up @@ -783,7 +783,7 @@ public void TestAnnotatedRelation2()
DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "rel", true, new string[] { "pk" }, new string[] { "fk" }, false, false);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void RepeatableSimpleElement()
{
var ds = new DataSet();
Expand Down Expand Up @@ -811,7 +811,7 @@ public void RepeatableSimpleElement()
DataSetAssertion.AssertDataRelation("rel", ds.Relations[0], "Foo_Bar", true, new string[] { "Foo_Id" }, new string[] { "Foo_Id" }, true, true);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void TestMoreThanOneRepeatableColumns()
{
var ds = new DataSet();
Expand Down Expand Up @@ -861,7 +861,7 @@ public void AutoIncrementStep()
Assert.True(ds.GetXmlSchema().IndexOf("AutoIncrementStep") > 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadConstraints()
{
var ds = new DataSet();
Expand Down Expand Up @@ -904,7 +904,7 @@ public void ReadConstraints()
Assert.Equal("fk1", ds.Tables[1].Constraints[0].ConstraintName);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadAnnotatedRelations_MultipleColumns()
{
var ds = new DataSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class DataSetReadXmlTest
</xs:schema>";
private const string schema2 = schema1 + xml8;

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadSimpleAuto()
{
DataSet ds;
Expand Down Expand Up @@ -285,7 +285,7 @@ public void ReadSimpleIgnoreSchema()
"NewDataSet", 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadSimpleInferSchema()
{
DataSet ds;
Expand Down Expand Up @@ -606,7 +606,7 @@ public void SequentialRead2()
DataSetAssertion.AssertDataTable("#3", ds.Tables[0], "root", 1, 2, 0, 0, 0, 0);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadComplexElementDocument()
{
var ds = new DataSet();
Expand Down Expand Up @@ -639,7 +639,7 @@ public void IgnoreSchemaShouldFillData()
Assert.Equal(0, dt.Rows.Count);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void NameConflictDSAndTable()
{
string xml = @"<PriceListDetails>
Expand All @@ -657,7 +657,7 @@ public void NameConflictDSAndTable()
Assert.NotNull(ds.Tables["PriceListDetails"]);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ColumnOrder()
{
string xml = "<?xml version=\"1.0\" standalone=\"yes\"?>" +
Expand Down Expand Up @@ -690,7 +690,7 @@ public void ColumnOrder()
Assert.Equal(3, ds.Tables[0].Columns[3].Ordinal);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void XmlSpace()
{
string xml = "<?xml version=\"1.0\" standalone=\"yes\"?>" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public void OwnWriteXmlSchema()
Assert.Equal("</xs:schema>", TextString);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadWriteXml()
{
var ds = new DataSet();
Expand Down Expand Up @@ -424,7 +424,7 @@ public void ReadWriteXml()
Assert.Equal("</Root>", TextString);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadWriteXmlDiffGram()
{
var ds = new DataSet();
Expand Down Expand Up @@ -507,7 +507,7 @@ public void ReadWriteXmlDiffGram()
Assert.Equal("</diffgr:diffgram>", TextString);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void WriteXmlSchema()
{
using (new ThreadCultureChange("fi-FI"))
Expand Down Expand Up @@ -989,7 +989,7 @@ public void WriteNestedTableXml()
Assert.Equal(sw.ToString().Replace("\r\n", "\n"), xml.Replace("\r\n", "\n"));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void WriteXmlToStream()
{
string xml = "<set><table1><col1>sample text</col1><col2/></table1><table2 attr='value'><col3>sample text 2</col3></table2></set>";
Expand Down Expand Up @@ -1028,7 +1028,7 @@ public void WtiteXmlEncodedXml()
Assert.Equal(sw.ToString().Replace("\r\n", "\n"), xml.Replace("\r\n", "\n"));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadWriteXml2()
{
string xml = "<FullTextResponse><Domains><AvailResponse info='y' name='novell-ximian-group' /><AvailResponse info='n' name='ximian' /></Domains></FullTextResponse>";
Expand All @@ -1046,7 +1046,7 @@ public void ReadWriteXml2()
Assert.Equal(xml, sw.ToString());
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void ReadWriteXml3()
{
string input = @"<FullTextResponse>
Expand Down Expand Up @@ -1559,7 +1559,7 @@ public void WriteXmlModeSchema()
Assert.Equal(result.Replace("\r\n", "\n"), xml.Replace("\r\n", "\n"));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
public void WriteXmlModeSchema1()
{
// Keeping the brackets as the test otherwise starts to fail.
Expand Down
Loading

0 comments on commit 8bcef22

Please sign in to comment.