diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 596777128..3cb8367b7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -96,10 +96,10 @@ jobs:
- name: Build
run: dotnet build --no-restore --verbosity normal
- name: Test
- run: dotnet test --no-restore --verbosity normal --logger trx --results-directory test-results/
+ run: dotnet test --no-restore -- --results-directory ${{ github.workspace }}/test-results/ --report-xunit-trx
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results (${{ matrix.os }} ${{ matrix.configuration }} ${{ matrix.projectloadstyle }})
- path: test-results/*
+ path: ${{ github.workspace }}/test-results/*
diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml
index f4857fc98..6c7e122fe 100644
--- a/.github/workflows/code-coverage.yml
+++ b/.github/workflows/code-coverage.yml
@@ -20,6 +20,7 @@ on:
jobs:
build_and_test:
+ if: false # Disable for now while getting XUnit v3 working
name: Run
env:
diff --git a/Directory.Build.props b/Directory.Build.props
index 7429523d0..ff8b5fa63 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -41,10 +41,11 @@
$(NoWarn);CS1685
net35
net35
- net462
- net462
- net462
+ net472
+ net472
+ net472
net472
+ $(DefineConstants);FEATURE_NO_VALIDATOR_CANCELLATIONTOKEN
@@ -53,9 +54,9 @@
$(NoWarn);CS1685
net40
net40
- net462
- net462
- net462
+ net472
+ net472
+ net472
net472
@@ -63,12 +64,12 @@
netstandard2.0;net8.0;net35;net40;net46
netstandard2.0;net6.0;net8.0;net35;net40;net46
- netstandard2.0;net462
+ netstandard2.0;net472
net8.0
- $(TestTargetFrameworks);net462
+ $(TestTargetFrameworks);net472
net8.0
net8.0
- $(TestTargetFrameworks);net472
+ $(SamplesFrameworks);net472
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 6ad8f144c..249d2f1b5 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -13,6 +13,7 @@
+
@@ -30,7 +31,6 @@
-
-
+
\ No newline at end of file
diff --git a/Open-XML-SDK.sln b/Open-XML-SDK.sln
index 7520970a5..da2d92545 100644
--- a/Open-XML-SDK.sln
+++ b/Open-XML-SDK.sln
@@ -67,8 +67,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{3653266D-2C8
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentFormat.OpenXml.Generator", "gen\DocumentFormat.OpenXml.Generator\DocumentFormat.OpenXml.Generator.csproj", "{E04F2FB4-DBC6-46DC-857C-F0E89B42F385}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocumentFormat.OpenXml.Generator.Tests", "test\DocumentFormat.OpenXml.Generator.Tests\DocumentFormat.OpenXml.Generator.Tests.csproj", "{BAC36A8F-AA8E-4097-B2BA-2EFE559BEE62}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Linq", "Linq", "{C5AE39F0-A152-471A-B90E-B8F4E94AA6C2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SvgExampleLinq", "samples\Linq\SvgExample\SvgExampleLinq.csproj", "{DE06FC2B-EABB-4535-BC73-C51A32B5AC01}"
@@ -149,10 +147,6 @@ Global
{E04F2FB4-DBC6-46DC-857C-F0E89B42F385}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E04F2FB4-DBC6-46DC-857C-F0E89B42F385}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E04F2FB4-DBC6-46DC-857C-F0E89B42F385}.Release|Any CPU.Build.0 = Release|Any CPU
- {BAC36A8F-AA8E-4097-B2BA-2EFE559BEE62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BAC36A8F-AA8E-4097-B2BA-2EFE559BEE62}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BAC36A8F-AA8E-4097-B2BA-2EFE559BEE62}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BAC36A8F-AA8E-4097-B2BA-2EFE559BEE62}.Release|Any CPU.Build.0 = Release|Any CPU
{DE06FC2B-EABB-4535-BC73-C51A32B5AC01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE06FC2B-EABB-4535-BC73-C51A32B5AC01}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE06FC2B-EABB-4535-BC73-C51A32B5AC01}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -211,7 +205,6 @@ Global
{E157C5F1-D70B-4939-A199-0B758FED8541} = {0782A132-968D-4BDD-911A-2C3074EAF886}
{3B82C340-3B10-42BF-9A2C-2E2327A9CFD4} = {0782A132-968D-4BDD-911A-2C3074EAF886}
{E04F2FB4-DBC6-46DC-857C-F0E89B42F385} = {3653266D-2C88-4487-8977-839CB3E78A0A}
- {BAC36A8F-AA8E-4097-B2BA-2EFE559BEE62} = {0782A132-968D-4BDD-911A-2C3074EAF886}
{C5AE39F0-A152-471A-B90E-B8F4E94AA6C2} = {7DAF7304-40CC-4180-88A5-9A89DD13C565}
{DE06FC2B-EABB-4535-BC73-C51A32B5AC01} = {7DAF7304-40CC-4180-88A5-9A89DD13C565}
{890B74DD-6316-4D56-B42A-5D66F10F88C6} = {C5AE39F0-A152-471A-B90E-B8F4E94AA6C2}
diff --git a/test/Common/ITestOutputHelperExtenstions.cs b/test/Common/ITestOutputHelperExtenstions.cs
index 4d0bcce7f..5f1cd0bf0 100644
--- a/test/Common/ITestOutputHelperExtenstions.cs
+++ b/test/Common/ITestOutputHelperExtenstions.cs
@@ -4,7 +4,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.IO;
-using Xunit.Abstractions;
+using Xunit;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/Common/VerifiableLog.cs b/test/Common/VerifiableLog.cs
index 83636b1e4..b6e957228 100644
--- a/test/Common/VerifiableLog.cs
+++ b/test/Common/VerifiableLog.cs
@@ -5,7 +5,6 @@
using System;
using Xunit;
-using Xunit.Abstractions;
namespace LogUtil
{
diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets
index 1e436c66f..46888c032 100644
--- a/test/Directory.Build.targets
+++ b/test/Directory.Build.targets
@@ -2,6 +2,11 @@
+
+ true
+ true
+
+
$(NoWarn);CA1303;CA1307;CA1309;CA1822;CA1062
$(MSBuildThisFileDirectory)Common/
@@ -12,20 +17,11 @@
Common/$([MSBuild]::MakeRelative($(CommonFilesDirectory), %(FullPath)))
+
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
-
- all
- runtime; build; native; contentfiles; analyzers
-
+
+
diff --git a/test/DocumentFormat.OpenXml.Benchmarks/DocumentFormat.OpenXml.Benchmarks.csproj b/test/DocumentFormat.OpenXml.Benchmarks/DocumentFormat.OpenXml.Benchmarks.csproj
index eae8b351a..c264eec26 100644
--- a/test/DocumentFormat.OpenXml.Benchmarks/DocumentFormat.OpenXml.Benchmarks.csproj
+++ b/test/DocumentFormat.OpenXml.Benchmarks/DocumentFormat.OpenXml.Benchmarks.csproj
@@ -12,7 +12,6 @@
-
diff --git a/test/DocumentFormat.OpenXml.Framework.Features.Tests/DocumentFormat.OpenXml.Framework.Features.Tests.csproj b/test/DocumentFormat.OpenXml.Framework.Features.Tests/DocumentFormat.OpenXml.Framework.Features.Tests.csproj
index 50e69d953..4586b4a24 100644
--- a/test/DocumentFormat.OpenXml.Framework.Features.Tests/DocumentFormat.OpenXml.Framework.Features.Tests.csproj
+++ b/test/DocumentFormat.OpenXml.Framework.Features.Tests/DocumentFormat.OpenXml.Framework.Features.Tests.csproj
@@ -5,6 +5,7 @@
true
enable
true
+ Exe
@@ -15,4 +16,9 @@
+
+
+
+
+
diff --git a/test/DocumentFormat.OpenXml.Framework.Tests/DocumentFormat.OpenXml.Framework.Tests.csproj b/test/DocumentFormat.OpenXml.Framework.Tests/DocumentFormat.OpenXml.Framework.Tests.csproj
index dd185f6ac..8d8acd638 100644
--- a/test/DocumentFormat.OpenXml.Framework.Tests/DocumentFormat.OpenXml.Framework.Tests.csproj
+++ b/test/DocumentFormat.OpenXml.Framework.Tests/DocumentFormat.OpenXml.Framework.Tests.csproj
@@ -4,6 +4,7 @@
$(TestTargetFrameworks)
true
false
+ Exe
@@ -24,4 +25,9 @@
+
+
+
+
+
diff --git a/test/DocumentFormat.OpenXml.Framework.Tests/ElementLookupTests.cs b/test/DocumentFormat.OpenXml.Framework.Tests/ElementLookupTests.cs
index c0665786a..7138c3ec4 100644
--- a/test/DocumentFormat.OpenXml.Framework.Tests/ElementLookupTests.cs
+++ b/test/DocumentFormat.OpenXml.Framework.Tests/ElementLookupTests.cs
@@ -12,7 +12,6 @@
using System.Linq;
using System.Reflection;
using Xunit;
-using Xunit.Abstractions;
using static DocumentFormat.OpenXml.Framework.Tests.TestUtility;
diff --git a/test/DocumentFormat.OpenXml.Framework.Tests/ObjectSizeTests.cs b/test/DocumentFormat.OpenXml.Framework.Tests/ObjectSizeTests.cs
index ba753bfb0..2f759f2b6 100644
--- a/test/DocumentFormat.OpenXml.Framework.Tests/ObjectSizeTests.cs
+++ b/test/DocumentFormat.OpenXml.Framework.Tests/ObjectSizeTests.cs
@@ -9,7 +9,6 @@
using System.Collections.Generic;
using System.Xml;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Framework.Tests;
diff --git a/test/DocumentFormat.OpenXml.Generator.Tests/DocumentFormat.OpenXml.Generator.Tests.csproj b/test/DocumentFormat.OpenXml.Generator.Tests/DocumentFormat.OpenXml.Generator.Tests.csproj
deleted file mode 100644
index cb683281c..000000000
--- a/test/DocumentFormat.OpenXml.Generator.Tests/DocumentFormat.OpenXml.Generator.Tests.csproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- $(LatestTargetFramework)
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/DocumentFormat.OpenXml.Generator.Tests/Verifiers/OpenXmlIncrementalSourceGeneratorVerifier.cs b/test/DocumentFormat.OpenXml.Generator.Tests/Verifiers/OpenXmlIncrementalSourceGeneratorVerifier.cs
deleted file mode 100644
index b3adb8622..000000000
--- a/test/DocumentFormat.OpenXml.Generator.Tests/Verifiers/OpenXmlIncrementalSourceGeneratorVerifier.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) Microsoft. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp;
-using Microsoft.CodeAnalysis.CSharp.Testing;
-using Microsoft.CodeAnalysis.Testing;
-using System;
-using System.Collections.Generic;
-using System.Collections.Immutable;
-
-namespace DocumentFormat.OpenXml.Generator.Tests.Verifiers
-{
- public static partial class OpenXmlIncrementalSourceGeneratorVerifier
- where TSourceGenerator : IIncrementalGenerator, new()
- {
- public class Test : CSharpSourceGeneratorTest
- {
- private static ImmutableDictionary NullableWarnings { get; } = GetNullableWarningsFromCompiler();
-
- public Test()
- {
- }
-
- public LanguageVersion LanguageVersion { get; set; } = LanguageVersion.Default;
-
- protected override IEnumerable GetSourceGenerators() => new[] { typeof(TSourceGenerator) };
-
- protected override CompilationOptions CreateCompilationOptions()
- {
- var compilationOptions = base.CreateCompilationOptions();
- return compilationOptions.WithSpecificDiagnosticOptions(
- compilationOptions.SpecificDiagnosticOptions.SetItems(NullableWarnings));
- }
-
- protected override ParseOptions CreateParseOptions()
- {
- return ((CSharpParseOptions)base.CreateParseOptions()).WithLanguageVersion(LanguageVersion);
- }
-
- private static ImmutableDictionary GetNullableWarningsFromCompiler()
- {
- string[] args = { "/warnaserror:nullable" };
- var commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory);
- return commandLineArguments.CompilationOptions.SpecificDiagnosticOptions;
- }
- }
- }
-}
diff --git a/test/DocumentFormat.OpenXml.Linq.Tests/DocumentFormat.OpenXml.Linq.Tests.csproj b/test/DocumentFormat.OpenXml.Linq.Tests/DocumentFormat.OpenXml.Linq.Tests.csproj
index 4b652391e..72c691526 100644
--- a/test/DocumentFormat.OpenXml.Linq.Tests/DocumentFormat.OpenXml.Linq.Tests.csproj
+++ b/test/DocumentFormat.OpenXml.Linq.Tests/DocumentFormat.OpenXml.Linq.Tests.csproj
@@ -4,6 +4,7 @@
$(TestTargetFrameworks)
true
enable
+ Exe
@@ -11,4 +12,8 @@
+
+
+
+
diff --git a/test/DocumentFormat.OpenXml.Packaging.Tests/DocumentFormat.OpenXml.Packaging.Tests.csproj b/test/DocumentFormat.OpenXml.Packaging.Tests/DocumentFormat.OpenXml.Packaging.Tests.csproj
index 7ead5da41..a4bef2071 100644
--- a/test/DocumentFormat.OpenXml.Packaging.Tests/DocumentFormat.OpenXml.Packaging.Tests.csproj
+++ b/test/DocumentFormat.OpenXml.Packaging.Tests/DocumentFormat.OpenXml.Packaging.Tests.csproj
@@ -3,6 +3,7 @@
$(TestTargetFrameworks)
true
+ Exe
diff --git a/test/DocumentFormat.OpenXml.Packaging.Tests/PartConstraintRuleTests.cs b/test/DocumentFormat.OpenXml.Packaging.Tests/PartConstraintRuleTests.cs
index e49ab7e96..9e2f89950 100644
--- a/test/DocumentFormat.OpenXml.Packaging.Tests/PartConstraintRuleTests.cs
+++ b/test/DocumentFormat.OpenXml.Packaging.Tests/PartConstraintRuleTests.cs
@@ -13,7 +13,6 @@
using System.Linq;
using System.Reflection;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Packaging.Tests/ParticleTests.cs b/test/DocumentFormat.OpenXml.Packaging.Tests/ParticleTests.cs
index 473b8fe24..8de022b7c 100644
--- a/test/DocumentFormat.OpenXml.Packaging.Tests/ParticleTests.cs
+++ b/test/DocumentFormat.OpenXml.Packaging.Tests/ParticleTests.cs
@@ -14,7 +14,6 @@
using System.Linq;
using System.Reflection;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Packaging.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests.Assets/DocumentFormat.OpenXml.Tests.Assets.csproj b/test/DocumentFormat.OpenXml.Tests.Assets/DocumentFormat.OpenXml.Tests.Assets.csproj
index c9944a2f2..add933b17 100644
--- a/test/DocumentFormat.OpenXml.Tests.Assets/DocumentFormat.OpenXml.Tests.Assets.csproj
+++ b/test/DocumentFormat.OpenXml.Tests.Assets/DocumentFormat.OpenXml.Tests.Assets.csproj
@@ -2,12 +2,8 @@
$(AssetsTargetFrameworks)
$(NoWarn);CA1822;CA1034
- false
-
-
-
\ No newline at end of file
diff --git a/test/DocumentFormat.OpenXml.Tests.Assets/TestAssets.cs b/test/DocumentFormat.OpenXml.Tests.Assets/TestAssets.cs
index fe24eddd7..a52f09bfb 100644
--- a/test/DocumentFormat.OpenXml.Tests.Assets/TestAssets.cs
+++ b/test/DocumentFormat.OpenXml.Tests.Assets/TestAssets.cs
@@ -5,7 +5,6 @@
using System.IO;
using System.Linq;
using System.Reflection;
-using Xunit;
namespace DocumentFormat.OpenXml.Tests
{
@@ -51,7 +50,10 @@ public static Stream GetStream(string name)
var stream = assembly.GetManifestResourceStream($"DocumentFormat.OpenXml.Tests.Assets.assets.{name}");
var names = assembly.GetManifestResourceNames().OrderBy(t => t).ToList();
- Assert.NotNull(stream);
+ if (stream is null)
+ {
+ throw new InvalidOperationException($"Could not find stream '{name}' for test");
+ }
return stream;
}
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ChartTrackingRefBased/ChartTrackingRefBasedTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ChartTrackingRefBased/ChartTrackingRefBasedTest.cs
index 9235f67d9..041684911 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ChartTrackingRefBased/ChartTrackingRefBasedTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ChartTrackingRefBased/ChartTrackingRefBasedTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.ChartTrackingRefBasedClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.ChartTrackingRefBased
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentEx/CommentExTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentEx/CommentExTest.cs
index c5959cdc9..1633e2353 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentEx/CommentExTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentEx/CommentExTest.cs
@@ -23,7 +23,7 @@ public void CommentExInvalidFormat()
using (var doc = WordprocessingDocument.Open(stream, false))
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- var validateResults = validator.Validate(doc);
+ var validateResults = validator.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(validateResults);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentExPeople/CommentExPeopleTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentExPeople/CommentExPeopleTest.cs
index 25ce1c6d7..7c876013c 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentExPeople/CommentExPeopleTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/CommentExPeople/CommentExPeopleTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.CommentExPeopleClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.CommentExPeople
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ContentControl/ContentControlTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ContentControl/ContentControlTest.cs
index 314b47ef4..0390e65fc 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ContentControl/ContentControlTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ContentControl/ContentControlTest.cs
@@ -7,7 +7,6 @@
using System.IO;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.ContentControl
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/FootnoteColumns/FootnoteColumnsTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/FootnoteColumns/FootnoteColumnsTest.cs
index 758fe232b..4b983e456 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/FootnoteColumns/FootnoteColumnsTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/FootnoteColumns/FootnoteColumnsTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Tests.FootnoteColumnsClass;
using Xunit;
-using Xunit.Abstractions;
using W15 = DocumentFormat.OpenXml.Office2013.Word;
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/General/ConformanceTestBase.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/General/ConformanceTestBase.cs
index f389d92a7..36136ea33 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/General/ConformanceTestBase.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/General/ConformanceTestBase.cs
@@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Xunit.Abstractions;
+using Xunit;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Guide/GuideTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Guide/GuideTest.cs
index c41a361aa..d17a02326 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Guide/GuideTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Guide/GuideTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.GuideClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.GuideTest
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Pivot/PivotTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Pivot/PivotTest.cs
index ceec7c37a..7468ac81f 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Pivot/PivotTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Pivot/PivotTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.PivotClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.Pivot
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/PresetTransition/PresetTransitionTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/PresetTransition/PresetTransitionTest.cs
index 59df76622..575c4ccc4 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/PresetTransition/PresetTransitionTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/PresetTransition/PresetTransitionTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Tests.PresetTransitionClass;
using Xunit;
-using Xunit.Abstractions;
using P15 = DocumentFormat.OpenXml.Office2013.PowerPoint;
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Slicer/SlicerTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Slicer/SlicerTest.cs
index 6ea28e070..23df11192 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Slicer/SlicerTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Slicer/SlicerTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.SlicerClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.Slicer
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Theme/ThemeTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Theme/ThemeTest.cs
index 2175fa294..557173c03 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Theme/ThemeTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/Theme/ThemeTest.cs
@@ -6,7 +6,6 @@
using System.IO;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.Theme
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ThreadingInfo/ThreadingInfoTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ThreadingInfo/ThreadingInfoTest.cs
index 0b260fff9..169af4d80 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ThreadingInfo/ThreadingInfoTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/ThreadingInfo/ThreadingInfoTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.ChartTrackingRefBasedClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.ThreadingInfo
{
diff --git a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/WorkbookPr/WorkBookPrTest.cs b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/WorkbookPr/WorkBookPrTest.cs
index df09a2364..a3fda5a40 100644
--- a/test/DocumentFormat.OpenXml.Tests/ConformanceTest/WorkbookPr/WorkBookPrTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ConformanceTest/WorkbookPr/WorkBookPrTest.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Tests.WorkBookPrClass;
using System.IO;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.WorkBookPr
{
diff --git a/test/DocumentFormat.OpenXml.Tests/DocumentFormat.OpenXml.Tests.csproj b/test/DocumentFormat.OpenXml.Tests/DocumentFormat.OpenXml.Tests.csproj
index 13a58301e..c9be3ad99 100644
--- a/test/DocumentFormat.OpenXml.Tests/DocumentFormat.OpenXml.Tests.csproj
+++ b/test/DocumentFormat.OpenXml.Tests/DocumentFormat.OpenXml.Tests.csproj
@@ -3,6 +3,7 @@
$(TestTargetFrameworks)
true
+ Exe
@@ -10,6 +11,11 @@
+
+
+
+
+
diff --git a/test/DocumentFormat.OpenXml.Tests/Documents/FlatOpcAndCloningTests.cs b/test/DocumentFormat.OpenXml.Tests/Documents/FlatOpcAndCloningTests.cs
index 7cd0c0992..d11a26312 100644
--- a/test/DocumentFormat.OpenXml.Tests/Documents/FlatOpcAndCloningTests.cs
+++ b/test/DocumentFormat.OpenXml.Tests/Documents/FlatOpcAndCloningTests.cs
@@ -8,7 +8,6 @@
using System.Linq;
using System.Xml.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests.Documents
{
diff --git a/test/DocumentFormat.OpenXml.Tests/DocxTests01.cs b/test/DocumentFormat.OpenXml.Tests/DocxTests01.cs
index 86240c89a..f69761522 100644
--- a/test/DocumentFormat.OpenXml.Tests/DocxTests01.cs
+++ b/test/DocumentFormat.OpenXml.Tests/DocxTests01.cs
@@ -35,7 +35,7 @@ public void W055_Load_Save_Data_Bound_Content_Controls()
para.InsertBeforeSelf(newPara);
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -124,7 +124,7 @@ public void W052_CreateElementFromOuterXml()
var mdp = doc.MainDocumentPart;
var cnt = mdp.Document.Descendants().Count();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -139,7 +139,7 @@ public void W051_AddNewPart_ToOpenXmlPackage()
var pkg = (OpenXmlPackage)doc;
var wpcp = pkg.AddNewPart("application/xml", "rid1232131");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -167,7 +167,7 @@ public void W050_DeleteAdd_CoreExtendedProperties()
tnPart = doc.AddThumbnailPart("image/jpg");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -181,7 +181,7 @@ public void W049_AddNewPart_ToPackage()
{
var wpcp = doc.AddNewPart("application/xml", "rid1232131");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -208,7 +208,7 @@ public void W047_AddNewPart_ToPackage()
{
var wpcp = doc.AddNewPart("rid123123");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -226,7 +226,7 @@ public void W046_AddNewPart_ToPackage()
var wpcp = doc.AddNewPart();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -240,7 +240,7 @@ public void W045_AddNewPart_ToPart()
{
var wpcp = doc.MainDocumentPart.AddNewPart("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", "rid1232131");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -267,7 +267,7 @@ public void W043_AddNewPart()
{
var wpcp = doc.MainDocumentPart.AddNewPart("rid123123");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -281,7 +281,7 @@ public void W042_AddNewPart()
{
var wpcp = doc.MainDocumentPart.AddNewPart();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -296,7 +296,7 @@ public void W041_AddAlternativeFormatImportPart()
doc.MainDocumentPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.Html);
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -322,7 +322,7 @@ public void W040_AddExternalRelationship()
new Uri(@"c:/resources/image1.jpg", UriKind.Absolute));
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -339,7 +339,7 @@ public void W039_ChangeDocumentType()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -353,7 +353,7 @@ public void W038_DocxCreation_Package()
var cnt = doc.MainDocumentPart.Document.Descendants().Count();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -375,7 +375,7 @@ public void W037_DocxCreation_Package_Settings()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Equal(35, v.Validate(doc).Count());
+ Assert.Equal(35, v.Validate(doc, TestContext.Current.CancellationToken).Count());
}
}
}
@@ -417,7 +417,7 @@ public void W035_DocxCreation_Package()
doc.MainDocumentPart.Document.Save();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -439,7 +439,7 @@ public void W034_DocxCreation()
doc.MainDocumentPart.Document.Save();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -461,7 +461,7 @@ public void W033_DocxCreation()
doc.MainDocumentPart.Document.Save();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -488,7 +488,7 @@ public void W032_AnnotationsOnElements()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -511,7 +511,7 @@ public void W031_AnnotationsOnParts()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -528,7 +528,7 @@ public void W030_DeleteReferenceRelationship2()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Equal(2, v.Validate(doc).Count());
+ Assert.Equal(2, v.Validate(doc, TestContext.Current.CancellationToken).Count());
}
}
@@ -591,7 +591,7 @@ public void W026_AddRemoveNamespaceDeclaration()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -608,7 +608,7 @@ public void W025_ClearAllAttributes()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -623,7 +623,7 @@ public void W024_LastChild_LookupPrefix()
var p = firstPara.LookupPrefix("http://schemas.openxmlformats.org/wordprocessingml/2006/main");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -638,7 +638,7 @@ public void W023_NamespaceDeclarations()
var ns = firstPara.NamespaceDeclarations;
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -654,7 +654,7 @@ public void W022_InnerXml_InnerText()
var s2 = firstPara.InnerText;
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -669,7 +669,7 @@ public void W021_OuterXml()
var s = firstPara.OuterXml;
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -688,7 +688,7 @@ public void W020_GetAttribute()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -711,7 +711,7 @@ public void W019_SetAttributes()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -727,7 +727,7 @@ public void W018_RemoveAttributes()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -749,7 +749,7 @@ public void W017_InsertBefore_InsertAfter()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -769,7 +769,7 @@ public void W016_InsertAfterSelf()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Single(v.Validate(doc));
+ Assert.Single(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -790,7 +790,7 @@ public void W015_InsertBeforeSelf()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
Assert.Collection(
- v.Validate(doc),
+ v.Validate(doc, TestContext.Current.CancellationToken),
e =>
{
Assert.Equal("Sem_UniqueAttributeValue", e.Id);
@@ -812,7 +812,7 @@ public void W014_MaxCharactersInPart()
using (var doc = WordprocessingDocument.Open(stream, false, openSettings))
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- var cnt = validator.Validate(doc).Count();
+ var cnt = validator.Validate(doc, TestContext.Current.CancellationToken).Count();
Assert.Equal(5, cnt);
}
@@ -832,7 +832,7 @@ public void W013_MarkupCompat_ProcessLoadedPartsOnly()
using (var doc = WordprocessingDocument.Open(stream, false, openSettings))
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- var results = validator.Validate(doc);
+ var results = validator.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(results);
}
@@ -851,7 +851,7 @@ public void W012_MarkupCompat_ProcessAllParts()
using (var doc = WordprocessingDocument.Open(stream, false, openSettings))
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- var cnt = validator.Validate(doc).Count();
+ var cnt = validator.Validate(doc, TestContext.Current.CancellationToken).Count();
Assert.Equal(0, cnt);
}
@@ -871,13 +871,13 @@ public void W011_MarkupCompat_InvalidValidation()
Assert.Throws(() =>
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2007);
- var cnt = validator.Validate(doc).Count();
+ var cnt = validator.Validate(doc, TestContext.Current.CancellationToken).Count();
validator = new OpenXmlValidator(FileFormatVersions.Office2010);
- cnt += validator.Validate(doc).Count();
+ cnt += validator.Validate(doc, TestContext.Current.CancellationToken).Count();
validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- cnt += validator.Validate(doc).Count();
+ cnt += validator.Validate(doc, TestContext.Current.CancellationToken).Count();
Assert.Equal(0, cnt);
});
@@ -894,7 +894,7 @@ public void W010_HyperlinkRelationships()
var extRels = mdp.HyperlinkRelationships;
var hyperlinkRel = extRels.First();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -929,7 +929,7 @@ public void W008_AddImageToDocx()
AddImageToBody(doc, mainPart.GetIdOfPart(imagePart));
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -952,7 +952,7 @@ public void W0056_AddImageToDocxWithMimeType()
AddImageToBody(doc, mainPart.GetIdOfPart(imagePart));
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -975,7 +975,7 @@ public void W0057_AddImageToDocxWithMimeType()
AddImageToBody(doc, mainPart.GetIdOfPart(imagePart));
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -998,7 +998,7 @@ public void W0058_AddImageToDocxWithMimeType()
AddImageToBody(doc, mainPart.GetIdOfPart(imagePart));
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -1021,7 +1021,7 @@ public void W0059_AddImageToDocxWithMimeType()
AddImageToBody(doc, mainPart.GetIdOfPart(imagePart));
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Single(errs);
}
@@ -1101,7 +1101,7 @@ public void W007_GetPartById_DeleteParts()
doc.MainDocumentPart.DeleteParts(partList);
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -1117,7 +1117,7 @@ public void W006_RemoveCommentsPart()
doc.MainDocumentPart.DeletePart(commentsPart);
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Equal(3, errs.Count());
}
@@ -1166,7 +1166,7 @@ public void W005_AddCommentsPart()
firstParagraph.InsertAfter(new W.Run(new W.CommentReference() { Id = id }), cmtEnd);
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -1193,7 +1193,7 @@ public void W004_DocxCreation()
doc.MainDocumentPart.Document.Save();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -1210,7 +1210,7 @@ public void W003_DocxValidation(FileFormatVersions version, int count)
{
var validator = new OpenXmlValidator(version);
- Assert.Equal(count, validator.Validate(doc).Count());
+ Assert.Equal(count, validator.Validate(doc, TestContext.Current.CancellationToken).Count());
}
}
@@ -1225,7 +1225,7 @@ public void W002_PlainDocxValidation(FileFormatVersions version)
{
var validator = new OpenXmlValidator(version);
- Assert.Empty(validator.Validate(doc));
+ Assert.Empty(validator.Validate(doc, TestContext.Current.CancellationToken));
}
}
diff --git a/test/DocumentFormat.OpenXml.Tests/IsoStrictTest/IsoStrictTest.cs b/test/DocumentFormat.OpenXml.Tests/IsoStrictTest/IsoStrictTest.cs
index 00ae3afa4..0f05e4e61 100644
--- a/test/DocumentFormat.OpenXml.Tests/IsoStrictTest/IsoStrictTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/IsoStrictTest/IsoStrictTest.cs
@@ -183,7 +183,7 @@ public void ValidateISOStrictNamespace(string path)
using (var document = file.Open(false))
{
var isoValidator = new OpenXmlValidator(FileFormatVersions.Office2010);
- var errorList = isoValidator.Validate(document);
+ var errorList = isoValidator.Validate(document, TestContext.Current.CancellationToken);
Assert.NotNull(errorList);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/OFCatTest/Robustness.cs b/test/DocumentFormat.OpenXml.Tests/OFCatTest/Robustness.cs
index ed50f9e6f..ef60cb8fd 100644
--- a/test/DocumentFormat.OpenXml.Tests/OFCatTest/Robustness.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OFCatTest/Robustness.cs
@@ -27,7 +27,7 @@ public void OFCATFull(string entry)
using (var doc = SpreadsheetDocument.Open(stream, false))
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- var validateResults = validator.Validate(doc);
+ var validateResults = validator.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(validateResults);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/CodeGenSanityTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/CodeGenSanityTest.cs
index 8adedb3b5..5bdeffdd1 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/CodeGenSanityTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/CodeGenSanityTest.cs
@@ -5,7 +5,6 @@
using DocumentFormat.OpenXml.Wordprocessing;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
using static DocumentFormat.OpenXml.Tests.TestAssets;
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/DocumentTraverseTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/DocumentTraverseTest.cs
index 3e6a3dd14..ff15b64aa 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/DocumentTraverseTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/DocumentTraverseTest.cs
@@ -9,7 +9,6 @@
using System.Linq;
using System.Xml.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/GenerateList4LowLevelTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/GenerateList4LowLevelTest.cs
index a76da5ddb..67e594c7f 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/GenerateList4LowLevelTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/GenerateList4LowLevelTest.cs
@@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
using static DocumentFormat.OpenXml.Tests.TestAssets;
@@ -190,7 +189,7 @@ public void MaxNumberOfErrorsTest(int maxErrorCount, int expectedErrorCount)
MaxNumberOfErrors = maxErrorCount,
};
- var errors = validator.Validate(package);
+ var errors = validator.Validate(package, TestContext.Current.CancellationToken);
Assert.Equal(expectedErrorCount, errors.Count());
}
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/MarkupCompatibilityTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/MarkupCompatibilityTest.cs
index 5081382bd..b1d0a07e9 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/MarkupCompatibilityTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/MarkupCompatibilityTest.cs
@@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
using static DocumentFormat.OpenXml.Tests.TestAssets;
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenSettingsTestClass.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenSettingsTestClass.cs
index 432a123b9..9023ff9a2 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenSettingsTestClass.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenSettingsTestClass.cs
@@ -4,7 +4,6 @@
using DocumentFormat.OpenXml.Packaging;
using System;
using Xunit;
-using Xunit.Abstractions;
using static DocumentFormat.OpenXml.Tests.TestAssets;
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlCompositeElementTestClass.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlCompositeElementTestClass.cs
index 628c7faed..adca324fa 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlCompositeElementTestClass.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlCompositeElementTestClass.cs
@@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlDomTestBase.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlDomTestBase.cs
index 02c0d2b92..65774ff38 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlDomTestBase.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlDomTestBase.cs
@@ -13,7 +13,6 @@
using System.Xml;
using System.Xml.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlReaderWriterTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlReaderWriterTest.cs
index 43e6b20a0..2f9240d56 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlReaderWriterTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlReaderWriterTest.cs
@@ -10,7 +10,6 @@
using System.Xml;
using System.Xml.Linq;
using Xunit;
-using Xunit.Abstractions;
#pragma warning disable 162
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleTypeTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleTypeTest.cs
index e410bffc0..4b0cf0c0d 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleTypeTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleTypeTest.cs
@@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleValueTest.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleValueTest.cs
index f4a12f11b..c54c76c1f 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleValueTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlDomTest/OpenXmlSimpleValueTest.cs
@@ -4,7 +4,6 @@
using System;
using System.Globalization;
using Xunit;
-using Xunit.Abstractions;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/OpenXmlTestBase.cs b/test/DocumentFormat.OpenXml.Tests/OpenXmlTestBase.cs
index a7e36117d..d67cb31b6 100644
--- a/test/DocumentFormat.OpenXml.Tests/OpenXmlTestBase.cs
+++ b/test/DocumentFormat.OpenXml.Tests/OpenXmlTestBase.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using LogUtil;
-using Xunit.Abstractions;
+using Xunit;
namespace DocumentFormat.OpenXml.Tests
{
diff --git a/test/DocumentFormat.OpenXml.Tests/PptxTests01.cs b/test/DocumentFormat.OpenXml.Tests/PptxTests01.cs
index 90492c30c..fb888cde3 100644
--- a/test/DocumentFormat.OpenXml.Tests/PptxTests01.cs
+++ b/test/DocumentFormat.OpenXml.Tests/PptxTests01.cs
@@ -32,7 +32,7 @@ public void P007_PptxCreation_Package_Settings()
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Empty(v.Validate(doc));
+ Assert.Empty(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
}
@@ -50,7 +50,7 @@ public void P006_PresentationDocument_Open()
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Empty(v.Validate(doc));
+ Assert.Empty(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -69,7 +69,7 @@ public void P005_PptxCreation_Package_Settings()
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Empty(v.Validate(doc));
+ Assert.Empty(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
}
@@ -87,7 +87,7 @@ public void P004_SpreadsheetDocument_Open()
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Empty(v.Validate(doc));
+ Assert.Empty(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -100,7 +100,7 @@ public void P003_PptxCreation_Stream()
CreatePresentation(doc);
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
@@ -411,7 +411,7 @@ public void P002_Pptx_DeleteAdd_CoreExtendedProperties()
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- Assert.Empty(v.Validate(doc));
+ Assert.Empty(v.Validate(doc, TestContext.Current.CancellationToken));
}
}
@@ -423,13 +423,13 @@ public void PptxValidation(string path, int expectedErrorCount)
using (var doc = PresentationDocument.Open(stream, false))
{
var validator = new OpenXmlValidator(FileFormatVersions.Office2007);
- var cnt = validator.Validate(doc).Count();
+ var cnt = validator.Validate(doc, TestContext.Current.CancellationToken).Count();
validator = new OpenXmlValidator(FileFormatVersions.Office2010);
- cnt += validator.Validate(doc).Count();
+ cnt += validator.Validate(doc, TestContext.Current.CancellationToken).Count();
validator = new OpenXmlValidator(FileFormatVersions.Office2013);
- cnt += validator.Validate(doc).Count();
+ cnt += validator.Validate(doc, TestContext.Current.CancellationToken).Count();
Assert.Equal(expectedErrorCount, cnt);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/SimpleTypes/Base64BinaryValueTests.cs b/test/DocumentFormat.OpenXml.Tests/SimpleTypes/Base64BinaryValueTests.cs
index 39befa9bc..39162e98a 100644
--- a/test/DocumentFormat.OpenXml.Tests/SimpleTypes/Base64BinaryValueTests.cs
+++ b/test/DocumentFormat.OpenXml.Tests/SimpleTypes/Base64BinaryValueTests.cs
@@ -2,7 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
-using Xunit.Abstractions;
+using Xunit;
namespace DocumentFormat.OpenXml.Tests.SimpleTypes
{
diff --git a/test/DocumentFormat.OpenXml.Tests/Spreadsheet/CellTests.cs b/test/DocumentFormat.OpenXml.Tests/Spreadsheet/CellTests.cs
index 8937ab6ee..68d04549b 100644
--- a/test/DocumentFormat.OpenXml.Tests/Spreadsheet/CellTests.cs
+++ b/test/DocumentFormat.OpenXml.Tests/Spreadsheet/CellTests.cs
@@ -49,7 +49,7 @@ public void CellValidationTest(string value, Value type, bool isValid)
};
var validator = new OpenXmlValidator();
- var results = validator.Validate(cell);
+ var results = validator.Validate(cell, TestContext.Current.CancellationToken);
if (isValid)
{
@@ -82,7 +82,7 @@ public void CellBooleanValueValidationTest(bool value, Value type, bool isValid)
};
var validator = new OpenXmlValidator();
- var results = validator.Validate(cell);
+ var results = validator.Validate(cell, TestContext.Current.CancellationToken);
if (isValid)
{
diff --git a/test/DocumentFormat.OpenXml.Tests/TestOffice2016.cs b/test/DocumentFormat.OpenXml.Tests/TestOffice2016.cs
index fe7c21ab6..d36a1a1fe 100644
--- a/test/DocumentFormat.OpenXml.Tests/TestOffice2016.cs
+++ b/test/DocumentFormat.OpenXml.Tests/TestOffice2016.cs
@@ -21,7 +21,7 @@ public void OF16_007_SymEx(string name)
using (var wDoc = WordprocessingDocument.Open(stream, false))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2016);
- var errors = v.Validate(wDoc);
+ var errors = v.Validate(wDoc, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
@@ -88,7 +88,7 @@ public void OF16_004_ValidatePptx_2013(string name)
using (var pDoc = PresentationDocument.Open(stream, false))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errors = v.Validate(pDoc);
+ var errors = v.Validate(pDoc, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
@@ -110,7 +110,7 @@ public void OF16_003_ValidateDocx_2013(string name)
using (var wDoc = WordprocessingDocument.Open(stream, false))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errors = v.Validate(wDoc);
+ var errors = v.Validate(wDoc, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
@@ -127,7 +127,7 @@ public void OF16_002_ValidatePptx_2016(string name)
using (var pDoc = PresentationDocument.Open(stream, false))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2016);
- var errors = v.Validate(pDoc);
+ var errors = v.Validate(pDoc, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
@@ -149,7 +149,7 @@ public void OF16_001_ValidateDocx_2016(string name)
using (var wDoc = WordprocessingDocument.Open(stream, false))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2016);
- var errors = v.Validate(wDoc);
+ var errors = v.Validate(wDoc, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/Validation/Semantic/AttributeRequiredConditionToValueTests.cs b/test/DocumentFormat.OpenXml.Tests/Validation/Semantic/AttributeRequiredConditionToValueTests.cs
index c9925770f..015f28491 100644
--- a/test/DocumentFormat.OpenXml.Tests/Validation/Semantic/AttributeRequiredConditionToValueTests.cs
+++ b/test/DocumentFormat.OpenXml.Tests/Validation/Semantic/AttributeRequiredConditionToValueTests.cs
@@ -35,7 +35,7 @@ public void NoErrors(string required, string condition)
element.Condition = condition;
}
- var results = validator.Validate(element);
+ var results = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(results);
}
@@ -49,7 +49,7 @@ public void SemanticErrorValue()
Condition = ExpectedConditionValue,
};
- var error = Assert.Single(validator.Validate(element));
+ var error = Assert.Single(validator.Validate(element, TestContext.Current.CancellationToken));
Assert.Equal("Sem_AttributeRequiredConditionToValue", error.Id);
Assert.Equal(ValidationErrorType.Semantic, error.ErrorType);
diff --git a/test/DocumentFormat.OpenXml.Tests/XlsxTests01.cs b/test/DocumentFormat.OpenXml.Tests/XlsxTests01.cs
index fb1736d7d..21f91112b 100644
--- a/test/DocumentFormat.OpenXml.Tests/XlsxTests01.cs
+++ b/test/DocumentFormat.OpenXml.Tests/XlsxTests01.cs
@@ -30,7 +30,7 @@ public void X008_XlsxCreation_Package_Settings()
using (var doc = SpreadsheetDocument.Open(package, openSettings))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
var cnt = errs.Count();
Assert.True(cnt == 1 || cnt == 0);
@@ -50,7 +50,7 @@ public void X007_SpreadsheetDocument_Open()
using (var doc = SpreadsheetDocument.Open(stream, false))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
var cnt = errs.Count();
Assert.True(cnt == 1 || cnt == 0);
@@ -77,7 +77,7 @@ public void X006_Xlsx_DeleteAdd_CoreExtendedProperties()
tnPart = doc.AddThumbnailPart("image/jpg");
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
var cnt = errs.Count();
Assert.True(cnt == 1 || cnt == 0);
@@ -97,7 +97,7 @@ public void X005_XlsxCreation_Package_Settings()
using (var doc = SpreadsheetDocument.Open(package, openSettings))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
var cnt = errs.Count();
Assert.True(cnt == 1 || cnt == 0);
@@ -116,7 +116,7 @@ public void X004_SpreadsheetDocument_Open()
using (var doc = SpreadsheetDocument.Open(stream, true, openSettings))
{
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
var cnt = errs.Count();
Assert.True(cnt == 1 || cnt == 0);
@@ -147,7 +147,7 @@ public void X003_XlsxCreation_Stream()
workbookpart.Workbook.Save();
OpenXmlValidator v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
}
@@ -178,7 +178,7 @@ public void X002_XlsxCreation()
workbookpart.Workbook.Save();
var v = new OpenXmlValidator(FileFormatVersions.Office2013);
- var errs = v.Validate(doc);
+ var errs = v.Validate(doc, TestContext.Current.CancellationToken);
Assert.Empty(errs);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/ofapiTest/BugRegressionTest.cs b/test/DocumentFormat.OpenXml.Tests/ofapiTest/BugRegressionTest.cs
index a48cb1b84..b281f3c07 100644
--- a/test/DocumentFormat.OpenXml.Tests/ofapiTest/BugRegressionTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ofapiTest/BugRegressionTest.cs
@@ -8,7 +8,6 @@
using System;
using System.Linq;
using Xunit;
-using Xunit.Abstractions;
using static DocumentFormat.OpenXml.Tests.TestAssets;
@@ -41,28 +40,28 @@ public void Bug743591(FileFormatVersions version)
" " +
"");
- var results = validator.Validate(colorScale);
+ var results = validator.Validate(colorScale, TestContext.Current.CancellationToken);
Assert.Single(results);
Assert.Equal("Sch_UnexpectedElementContentExpectingComplex", results.First().Id);
Assert.EndsWith(":cfvo>.", results.First().Description);
colorScale.PrependChild(new DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObject() { Type = DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Min });
- results = validator.Validate(colorScale);
+ results = validator.Validate(colorScale, TestContext.Current.CancellationToken);
Assert.Empty(results);
colorScale.PrependChild(new DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObject() { Type = DocumentFormat.OpenXml.Spreadsheet.ConditionalFormatValueObjectValues.Max });
- results = validator.Validate(colorScale);
+ results = validator.Validate(colorScale, TestContext.Current.CancellationToken);
Assert.Empty(results);
colorScale.LastChild.Remove();
- results = validator.Validate(colorScale);
+ results = validator.Validate(colorScale, TestContext.Current.CancellationToken);
Assert.Single(results);
Assert.Equal("Sch_IncompleteContentExpectingComplex", results.First().Id);
Assert.EndsWith(":color>.", results.First().Description);
colorScale.Append(new DocumentFormat.OpenXml.Spreadsheet.Color());
colorScale.Append(new DocumentFormat.OpenXml.Spreadsheet.Color());
- results = validator.Validate(colorScale);
+ results = validator.Validate(colorScale, TestContext.Current.CancellationToken);
Assert.Empty(results);
}
@@ -91,7 +90,7 @@ public void Bug704004(FileFormatVersions version)
new RunProperties(new RunFonts() { Hint = FontTypeHintValues.EastAsia })));
// an empty "AlternateContent"
- var errors = validator.Validate(p); // should no hang, no OOM
+ var errors = validator.Validate(p, TestContext.Current.CancellationToken); // should no hang, no OOM
Assert.Collection(
errors.OrderBy(e => e.Id),
@@ -109,13 +108,13 @@ public void Bug704004(FileFormatVersions version)
// append an empty "Choice"
p.AddNamespaceDeclaration("w14", "http://w14");
acb.AppendChild(new AlternateContentChoice() { Requires = "w14" });
- errors = validator.Validate(p); // should no hang, no OOM
+ errors = validator.Validate(p, TestContext.Current.CancellationToken); // should no hang, no OOM
Assert.Single(errors);
Assert.Same(p.FirstChild.NextSibling().FirstChild.NextSibling(), errors.ElementAt(0).RelatedNode);
// append an empty "Fallback"
acb.AppendChild(new AlternateContentFallback());
- errors = validator.Validate(p); // should no hang, no OOM
+ errors = validator.Validate(p, TestContext.Current.CancellationToken); // should no hang, no OOM
Assert.Single(errors);
Assert.Same(p.FirstChild.NextSibling().FirstChild.NextSibling(), errors.ElementAt(0).RelatedNode);
}
@@ -131,7 +130,7 @@ public void Bug583585_NotRequired(FileFormatVersions version)
var element = new DocumentFormat.OpenXml.Presentation.ModificationVerifier();
element.SaltData = "8fkqu/A/6B1OQrRX1Vb3oQ";
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Collection(errors.OrderBy(t => t.Description), e =>
{
@@ -153,7 +152,7 @@ public void Bug583585(FileFormatVersions version)
var element = new DocumentFormat.OpenXml.Presentation.ModificationVerifier();
element.SaltData = "8fkqu/A/6B1OQrRX1Vb3oQ";
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Collection(
errors.OrderBy(t => t.Description),
@@ -232,7 +231,7 @@ public void Bug669663(FileFormatVersions version)
var framePr = new FrameProperties();
framePr.Height = 32767;
- var errors = validator.Validate(framePr);
+ var errors = validator.Validate(framePr, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", errors.First().Id);
@@ -247,7 +246,7 @@ public void Bug663834(FileFormatVersions version)
DocumentFormat.OpenXml.Wordprocessing.StatusText st = new StatusText();
st.Val = "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111";
- var errors = validator.Validate(st);
+ var errors = validator.Validate(st, TestContext.Current.CancellationToken);
Assert.Collection(errors, e =>
{
@@ -272,7 +271,7 @@ public void Bug663841(FileFormatVersions version)
cn.RotatedBoundingBox.Items.Add("aaa");
cn.RotatedBoundingBox.Items.Add("bbb");
- var errors = validator.Validate(cn);
+ var errors = validator.Validate(cn, TestContext.Current.CancellationToken);
Assert.Collection(errors, e =>
{
@@ -295,7 +294,7 @@ public void Bug662650_2007(FileFormatVersions version)
spsm.Val = new StringValue();
spsm.Val.Value = "aaaaaa";
- var errors = validator.Validate(spsm);
+ var errors = validator.Validate(spsm, TestContext.Current.CancellationToken);
Assert.Collection(errors, e =>
{
@@ -320,7 +319,7 @@ public void Bug662650(FileFormatVersions version)
spsm.Val = new StringValue();
spsm.Val.Value = "aaaaaa";
- var errors = validator.Validate(spsm);
+ var errors = validator.Validate(spsm, TestContext.Current.CancellationToken);
Assert.Collection(errors, e =>
{
@@ -341,11 +340,11 @@ public void Bug662644(FileFormatVersions version)
DocumentFormat.OpenXml.Office2010.Excel.FormControlProperties fp = new DocumentFormat.OpenXml.Office2010.Excel.FormControlProperties();
- var errors = validator.Validate(fp);
+ var errors = validator.Validate(fp, TestContext.Current.CancellationToken);
Assert.Empty(errors);
fp.AppendChild(new DocumentFormat.OpenXml.Office2010.Excel.BorderColor());
- errors = validator.Validate(fp);
+ errors = validator.Validate(fp, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
Assert.Equal("Sch_InvalidElementContentExpectingComplex", errors.First().Id);
@@ -363,7 +362,7 @@ public void Bug643538(FileFormatVersions version)
element.EmbeddedObjectProperties = new DocumentFormat.OpenXml.Spreadsheet.EmbeddedObjectProperties();
// In Office2007, the OleObject has no children.
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(element, errors.First().Node);
Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
@@ -371,7 +370,7 @@ public void Bug643538(FileFormatVersions version)
// Office2010, no error on OleObject, but an error on EmbeddedObjectProperties.
var o14Validator = new OpenXmlValidator(FileFormatVersions.Office2010);
- errors = o14Validator.Validate(element);
+ errors = o14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(element.EmbeddedObjectProperties, errors.First().Node);
Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
@@ -390,7 +389,7 @@ public void Bug319778(FileFormatVersions version)
element.DistanceFromLeft = new UInt32Value();
element.DistanceFromLeft.InnerText = "Foo";
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(element, errors.First().Node);
Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
@@ -408,7 +407,7 @@ public void Bug448264(FileFormatVersions version)
tcmd.AppendChild(new TopMargin());
var errorChild = tcmd.AppendChild(new LeftMargin()); // LeftMargin is wrong element, it should be TableCellLeftMargin, but the two element has same element tag.
- var errors = validator.Validate(tcmd);
+ var errors = validator.Validate(tcmd, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(tcmd, errors.First().Node);
Assert.Same(errorChild, errors.First().RelatedNode);
@@ -428,7 +427,7 @@ public void Bug514988(FileFormatVersions version)
OpenXmlAttribute rsidR = paragraph.GetAttribute("rsidR", paragraph.NamespaceUri);
OpenXmlAttribute newattr = new OpenXmlAttribute(rsidR.LocalName, rsidR.NamespaceUri, "0102");
paragraph.SetAttribute(newattr);
- var errors = new OpenXmlValidator().Validate(paragraph);
+ var errors = new OpenXmlValidator().Validate(paragraph, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Equal(ValidationErrorType.Schema, errors.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", errors.First().Id);
@@ -443,7 +442,7 @@ public void Bug423988(FileFormatVersions version)
var shape = new DocumentFormat.OpenXml.Drawing.Spreadsheet.Shape();
shape.TextBody = new DocumentFormat.OpenXml.Drawing.Spreadsheet.TextBody();
- var errors = validator.Validate(shape);
+ var errors = validator.Validate(shape, TestContext.Current.CancellationToken);
Assert.Collection(
errors.OrderBy(t => t.Id),
@@ -473,7 +472,7 @@ public void Bug429396(FileFormatVersions version)
DocumentFormat.OpenXml.ExtendedProperties.DocumentSecurity docsecurity = new DocumentFormat.OpenXml.ExtendedProperties.DocumentSecurity();
- var errors = validator.Validate(docsecurity);
+ var errors = validator.Validate(docsecurity, TestContext.Current.CancellationToken);
Assert.Collection(errors, e =>
{
@@ -493,7 +492,7 @@ public void Bug425476(FileFormatVersions version)
var validator = new OpenXmlValidator(version);
var element = new Shading() { Color = "invalid union value", Val = ShadingPatternValues.Percent10 };
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Collection(errors, e =>
{
@@ -514,7 +513,7 @@ public void Bug412116(FileFormatVersions version)
DocumentFormat.OpenXml.Drawing.Charts.Trendline tl = new DocumentFormat.OpenXml.Drawing.Charts.Trendline();
tl.AppendChild(new DocumentFormat.OpenXml.Drawing.Diagrams.ShapeProperties());
- var errors = validator.Validate(tl);
+ var errors = validator.Validate(tl, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(tl, errors.First().Node);
}
@@ -526,7 +525,7 @@ public void Bug345436(FileFormatVersions version)
var validator = new OpenXmlValidator(version);
var p = new Paragraph(new DocumentFormat.OpenXml.Wordprocessing.SectionProperties());
- var errors = validator.Validate(p);
+ var errors = validator.Validate(p, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(p, errors.First().Node);
Assert.EndsWith("List of possible elements expected: .", errors.First().Description);
@@ -542,7 +541,7 @@ public void Bug403545(FileFormatVersions version)
lvl.AppendChild(new StartNumberingValue() { Val = 1 });
lvl.AddNamespaceDeclaration("O15", "http://O15.com");
var ac = lvl.AppendChild(new AlternateContent(new AlternateContentChoice() { Requires = "O15" }, new AlternateContentFallback()));
- var errors = validator.Validate(lvl);
+ var errors = validator.Validate(lvl, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
@@ -554,13 +553,13 @@ public void Bug424104(FileFormatVersions version)
// change to without minOccurs
var pext = new DocumentFormat.OpenXml.Presentation.Extension();
pext.Uri = "http://www.live.com";
- errors = validator.Validate(pext);
+ errors = validator.Validate(pext, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.EndsWith("any element in namespace '##any'.", errors.First().Description);
}
@@ -572,7 +571,7 @@ public void Bug423974(FileFormatVersions version)
var validator = new OpenXmlValidator(version);
var element = new DocumentFormat.OpenXml.Drawing.Spreadsheet.Shape();
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Equal("The element has incomplete content.".Length, errors.First().Description.LastIndexOf(" List of possible elements expected:"));
}
@@ -584,12 +583,12 @@ public void Bug423998(FileFormatVersions version)
var validator = new OpenXmlValidator(version);
var element = new DocumentFormat.OpenXml.Drawing.Spreadsheet.Shape();
- var errors = validator.Validate(element);
+ var errors = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Equal("The element has incomplete content.".Length, errors.First().Description.LastIndexOf(" List of possible elements expected:"));
element.AppendChild(new DocumentFormat.OpenXml.Drawing.Spreadsheet.TextBody());
- var errors2 = validator.Validate(element);
+ var errors2 = validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Equal(2, errors2.Count());
var message1 = errors.First().Description;
diff --git a/test/DocumentFormat.OpenXml.Tests/ofapiTest/McValidationTest.cs b/test/DocumentFormat.OpenXml.Tests/ofapiTest/McValidationTest.cs
index 93a86620e..2e5b0b7dc 100644
--- a/test/DocumentFormat.OpenXml.Tests/ofapiTest/McValidationTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ofapiTest/McValidationTest.cs
@@ -296,16 +296,16 @@ public void AcbValidationTest()
p.InsertAfter(acb, pPr);
var validator = new OpenXmlValidator();
- var errors = validator.Validate(p);
+ var errors = validator.Validate(p, TestContext.Current.CancellationToken);
Assert.Empty(errors);
p.AppendChild(new OpenXmlUnknownElement("w15test", "art", "http://w15.com"));
- errors = validator.Validate(p);
+ errors = validator.Validate(p, TestContext.Current.CancellationToken);
Assert.Single(errors);
p.RemoveChild(p.LastChild);
acb.LastChild.Append(new OpenXmlUnknownElement("w15test", "art", "http://w15.com"));
- errors = validator.Validate(p);
+ errors = validator.Validate(p, TestContext.Current.CancellationToken);
Assert.Single(errors);
}
@@ -329,7 +329,7 @@ public void AcbContentValidationTest2007()
// Should report error in "Fallback" branch.
var validator = new OpenXmlValidator(FileFormatVersions.Office2007);
- var errors = validator.Validate(p);
+ var errors = validator.Validate(p, TestContext.Current.CancellationToken);
var error = Assert.Single(errors);
Assert.Same(acb.LastChild.FirstChild, error.Node);
@@ -355,7 +355,7 @@ public void AcbContentValidationTest2010()
// Should report error in the "Choice" branch.
var validator = new OpenXmlValidator(FileFormatVersions.Office2010);
- var errors = validator.Validate(p);
+ var errors = validator.Validate(p, TestContext.Current.CancellationToken);
var error = Assert.Single(errors);
Assert.Same(acb.FirstChild.FirstChild, error.Node);
diff --git a/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlPartTest.cs b/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlPartTest.cs
index 7a0613e0b..fb74de896 100644
--- a/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlPartTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlPartTest.cs
@@ -73,7 +73,7 @@ public void HyperlinkRelationshipTest()
using (var testDocument = WordprocessingDocument.Open(stream, false))
{
var validator = new OpenXmlValidator();
- var errors = validator.Validate(testDocument);
+ var errors = validator.Validate(testDocument, TestContext.Current.CancellationToken);
Assert.Empty(errors);
var mainPart = testDocument.MainDocumentPart;
@@ -179,7 +179,7 @@ public void HyperlinkRelationshipTest3()
body.AppendChild(new Paragraph(new Hyperlink(new Run(new Text("empty URI link"))) { Id = link.Id }));
var validator = new OpenXmlValidator();
- var errors = validator.Validate(testDocument);
+ var errors = validator.Validate(testDocument, TestContext.Current.CancellationToken);
Assert.Empty(errors);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlValidatorTest.cs b/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlValidatorTest.cs
index 40364c123..4fdeb0daa 100644
--- a/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlValidatorTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlValidatorTest.cs
@@ -10,6 +10,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Threading;
using System.Xml;
using Xunit;
@@ -45,53 +46,53 @@ public void BooleanAttributeValidationTest()
// ***** good case ******
element.Val = true;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = false;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "false";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "true";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
element.Val.InnerText = "FALSE";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value 'FALSE'. The string 'FALSE' is not a valid 'Boolean' value.", actual.First().Description);
element.Val.InnerText = "off";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value 'off'. The string 'off' is not a valid 'Boolean' value.", actual.First().Description);
element.Val.InnerText = "00";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -118,24 +119,24 @@ public void SByteAttributeValidationTest()
// ***** good case ******
element.Val = 0;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = -10;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = -90;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 90;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -143,7 +144,7 @@ public void SByteAttributeValidationTest()
// sbyte overflow
element.Val.InnerText = "128";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -151,21 +152,21 @@ public void SByteAttributeValidationTest()
// sbyte overflow
element.Val.InnerText = "-129";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value '-129'. The string '-129' is not a valid 'SByte' value.", actual.First().Description);
element.Val = -91;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to -90.", actual.First().Description);
element.Val = 91;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -192,20 +193,20 @@ public void ByteAttributeValidationTest()
// ***** good case ******
element.Val = 2;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 90;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -213,7 +214,7 @@ public void ByteAttributeValidationTest()
// byte overflow
element.Val.InnerText = "256";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -221,14 +222,14 @@ public void ByteAttributeValidationTest()
// byte overflow
element.Val.InnerText = "-1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value '-1'. The string '-1' is not a valid 'Byte' value.", actual.First().Description);
element.Val = 0;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -241,7 +242,7 @@ public void ByteAttributeValidationTest()
// Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
// Assert.True(actual.First().Description.EndsWith(" The MinInclusive constraint failed."));
element.Val = 91;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -260,28 +261,28 @@ public void Int16ValueValidationTest()
// ***** good case ******
element.Text = "20";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "+20";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "-20";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = short.MinValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = short.MaxValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Text = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -289,7 +290,7 @@ public void Int16ValueValidationTest()
// Int16 overflow
element.Text = "65536";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -297,7 +298,7 @@ public void Int16ValueValidationTest()
// Int16 overflow
element.Text = "-65536";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -323,20 +324,20 @@ public void UInt16AttributeValidationTest()
// ***** good case ******
element.Val = 20;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 5;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 500;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -344,7 +345,7 @@ public void UInt16AttributeValidationTest()
// UInt16 overflow
element.Val.InnerText = "65536";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -352,28 +353,28 @@ public void UInt16AttributeValidationTest()
// UInt16 overflow
element.Val.InnerText = "-1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value '-1'. The string '-1' is not a valid 'UInt16' value.", actual.First().Description);
element.Val = 0;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 5.", actual.First().Description);
element.Val = 4;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 5.", actual.First().Description);
element.Val = 501;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -402,62 +403,62 @@ public void Int32AttributeValidationTest()
// ***** good case ******
element.Val = 0;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 100;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 21600000 - 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "+0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "-0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "100";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "+100";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val = new Int32Value();
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value 'abc'. The string 'abc' is not a valid 'Int32' value.", actual.First().Description);
element.Val = -1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 0.", actual.First().Description);
element.Val = 21600000;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MaxExclusive constraint failed. The value must be less than 21600000.", actual.First().Description);
element.Val = 21600000 * 2;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -489,42 +490,42 @@ public void Int32AttributeValidationTest()
// ***** good case ******
outerShadow.HorizontalSkew = 0;
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Empty(actual);
outerShadow.HorizontalSkew = -5400000 + 1;
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Empty(actual);
outerShadow.HorizontalSkew = 5400000 - 1;
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
outerShadow.HorizontalSkew = new Int32Value();
outerShadow.HorizontalSkew.InnerText = "abc";
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'kx' has invalid value 'abc'. The string 'abc' is not a valid 'Int32' value.", actual.First().Description);
outerShadow.HorizontalSkew = -5400000;
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinExclusive constraint failed. The value must be greater than -5400000.", actual.First().Description);
outerShadow.HorizontalSkew = 5400000;
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MaxExclusive constraint failed. The value must be less than 5400000.", actual.First().Description);
outerShadow.HorizontalSkew = 5400000 * 2;
- actual = O12Validator.Validate(outerShadow);
+ actual = O12Validator.Validate(outerShadow, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -546,49 +547,49 @@ public void Int32AttributeValidationTest()
// ***** good case ******
autoNum.StartAt = 1;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Empty(actual);
autoNum.StartAt = 100;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Empty(actual);
autoNum.StartAt = 32767;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
autoNum.StartAt = new Int32Value();
autoNum.StartAt.InnerText = "abc";
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'startAt' has invalid value 'abc'. The string 'abc' is not a valid 'Int32' value.", actual.First().Description);
autoNum.StartAt = -1;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 1.", actual.First().Description);
autoNum.StartAt = 0;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 1.", actual.First().Description);
autoNum.StartAt = 32767 + 1;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MaxInclusive constraint failed. The value must be less than or equal to 32767.", actual.First().Description);
autoNum.StartAt = 32767 * 2;
- actual = O12Validator.Validate(autoNum);
+ actual = O12Validator.Validate(autoNum, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -624,28 +625,28 @@ public void Int32ValueValidationTest()
// ***** good case ******
element.Text = "0";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "-00";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "20";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "+0020";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = int.MaxValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Text = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -653,14 +654,14 @@ public void Int32ValueValidationTest()
// Int32 overflow
element.Text = "2147483648";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The element 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing:col' has invalid value '2147483648'. The string '2147483648' is not a valid 'Int32' value.", actual.First().Description);
element.Text = "-1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -686,35 +687,35 @@ public void UInt32AttributeValidationTest()
// ***** good case ******
element.Val = 0;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 100;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 300;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val = new UInt32Value();
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value 'abc'. The string 'abc' is not a valid 'UInt32' value.", actual.First().Description);
element.Val = 300 + 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MaxInclusive constraint failed. The value must be less than or equal to 300.", actual.First().Description);
element.Val = 300 * 2;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -754,28 +755,28 @@ public void Int32AttributeValidationTest2()
// ***** good case ******
element.Cx = 914400 + 914400;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx = 914400;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx.InnerText = "914400";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx.InnerText = "+914400";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx = 51206400;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Cx.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -783,7 +784,7 @@ public void Int32AttributeValidationTest2()
// Int64 overflow
element.Cx.InnerText = "9223372036854775808";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -791,28 +792,28 @@ public void Int32AttributeValidationTest2()
// INt64 overflow
element.Cx.InnerText = "-9223372036854775808";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'cx' has invalid value '-9223372036854775808'. The string '-9223372036854775808' is not a valid 'Int32' value.", actual.First().Description);
element.Cx = -1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 914400.", actual.First().Description);
element.Cx = 914400 - 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 914400.", actual.First().Description);
element.Cx = 51206400 + 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -856,28 +857,28 @@ public void Int64AttributeValidationTest()
// ***** good case ******
element.Cx = 914400 + 914400;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx = 914400;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx.InnerText = "914400";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx.InnerText = "+914400";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Cx = 51206400;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Cx.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -885,7 +886,7 @@ public void Int64AttributeValidationTest()
// Int64 overflow
element.Cx.InnerText = "9223372036854775808";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -893,28 +894,28 @@ public void Int64AttributeValidationTest()
// INt64 overflow
element.Cx.InnerText = "-9223372036854775809";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'cx' has invalid value '-9223372036854775809'. The string '-9223372036854775809' is not a valid 'Int64' value.", actual.First().Description);
element.Cx = -2147483647L;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 0.", actual.First().Description);
element.Cx = 0 - 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 0.", actual.First().Description);
element.Cx = 2147483647L + 1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -932,24 +933,24 @@ public void UInt64ValueValidationTest()
// ***** good case ******
element.Text = "20";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = ulong.MinValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = uint.MaxValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = ulong.MaxValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Text = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -957,7 +958,7 @@ public void UInt64ValueValidationTest()
// UInt64 overflow
element.Text = "18446744073709551616";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -965,7 +966,7 @@ public void UInt64ValueValidationTest()
// UInt64 overflow
element.Text = "-1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -973,7 +974,7 @@ public void UInt64ValueValidationTest()
// unsigned int64 can not have "+"
element.Text = "+20";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -993,41 +994,41 @@ public void FloatAttributeValidationTest()
// ***** good case ******
element.Val = float.MinValue;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 10000.001F;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 10.23e4F;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = float.MaxValue;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = float.Epsilon;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = float.NegativeInfinity;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = float.PositiveInfinity;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// NaN (not a number)
element.Val = float.NaN;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1036,7 +1037,7 @@ public void FloatAttributeValidationTest()
#if !NETCOREAPP3_1 && !NET5_0_OR_GREATER // Fails due to https://github.com/dotnet/coreclr/issues/27898
// float overflow
element.Val.InnerText = "-3.402823e39";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1044,7 +1045,7 @@ public void FloatAttributeValidationTest()
// float overflow
element.Val.InnerText = "3.402823e39";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1071,28 +1072,28 @@ public void DoubleAttributeValidationTest()
// ***** good case ******
element.Val = 10000.001;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 10.23e4;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = double.MaxValue;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = double.Epsilon;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = double.PositiveInfinity;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1101,7 +1102,7 @@ public void DoubleAttributeValidationTest()
#if !NETCOREAPP3_1 && !NET5_0_OR_GREATER // Fails due to https://github.com/dotnet/coreclr/issues/27898
// double overflow
element.Val.InnerText = "-1.79769313486232e309";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1109,7 +1110,7 @@ public void DoubleAttributeValidationTest()
// double overflow
element.Val.InnerText = "1.79769313486232e309";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1117,21 +1118,21 @@ public void DoubleAttributeValidationTest()
#endif
element.Val = 0;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinExclusive constraint failed. The value must be greater than 0.", actual.First().Description);
element.Val = 0 - double.Epsilon;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinExclusive constraint failed. The value must be greater than 0.", actual.First().Description);
element.Val = double.NegativeInfinity;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1139,7 +1140,7 @@ public void DoubleAttributeValidationTest()
// NaN (not a number)
element.Val = double.NaN;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1158,27 +1159,27 @@ public void DoubleAttributeValidationTest()
// ***** good case ******
logBase.Val = 2.0;
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Empty(actual);
logBase.Val = 200;
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Empty(actual);
logBase.Val = 1000.0;
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
logBase.Val.InnerText = "abc";
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'val' has invalid value 'abc'. The string 'abc' is not a valid 'Double' value.", actual.First().Description);
logBase.Val = -1;
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1186,14 +1187,14 @@ public void DoubleAttributeValidationTest()
// ******************** double.Epsilon is too small so ((double)2.0) - double.Epsilon == 2.0
logBase.Val = 2.0 - 0.1;
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to 2.", actual.First().Description);
logBase.Val = 1000.0 + 0.1;
- actual = O12Validator.Validate(logBase);
+ actual = O12Validator.Validate(logBase, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1219,40 +1220,40 @@ public void DecimalAttributeValidationTest()
// ***** good case ******
element.StartAngle = decimal.MaxValue;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle = 100000.002M;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle.InnerText = "+100000.002";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle.InnerText = "-100000.002";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle = decimal.MinusOne;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle = decimal.MinValue;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle = decimal.One;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.StartAngle = decimal.Zero;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.StartAngle.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1260,7 +1261,7 @@ public void DecimalAttributeValidationTest()
// decimal overflow
element.StartAngle.InnerText = "-79228162514264337593543950336";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1268,7 +1269,7 @@ public void DecimalAttributeValidationTest()
// decimal overflow
element.StartAngle.InnerText = "79228162514264337593543950336";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1294,34 +1295,34 @@ public void IntegerAttributeValidationTest()
// ***** good case ******
element.Val = -2;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 2;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = 0;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/officeDocument/2006/math:val' has invalid value 'abc'. The string 'abc' is not a valid 'http://www.w3.org/2001/XMLSchema:integer' value.", actual.First().Description);
element.Val = -3;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The MinInclusive constraint failed. The value must be greater than or equal to -2.", actual.First().Description);
element.Val = 3;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1339,28 +1340,28 @@ public void NonNegativeIntegerValueValidationTest()
// ***** good case ******
element.Text = "20";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "+20";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "-0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = uint.MaxValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Text = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -1368,7 +1369,7 @@ public void NonNegativeIntegerValueValidationTest()
// negative integer is error.
element.Text = "-1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -1391,34 +1392,34 @@ public void PositiveIntegerAttributeValidationTest()
// ***** good case ******
element.Width = 1;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Width = 2;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Width = 1000;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Width.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'width' has invalid value 'abc'. The string 'abc' is not a valid 'http://www.w3.org/2001/XMLSchema:positiveInteger' value.", actual.First().Description);
element.Width = 0;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'width' has invalid value '0'. The string '0' is not a valid 'http://www.w3.org/2001/XMLSchema:positiveInteger' value.", actual.First().Description);
element.Width = -3;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1441,47 +1442,47 @@ public void DateTimeAttributeValidationTest()
// ***** good case ******
element.FullDate = DateTime.MinValue;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate = DateTime.MaxValue;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate = DateTime.Now;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate = DateTime.Today;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate = DateTime.UtcNow;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate.InnerText = XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Local);
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate.InnerText = XmlConvert.ToString(DateTime.Today, XmlDateTimeSerializationMode.RoundtripKind);
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.FullDate.InnerText = XmlConvert.ToString(DateTime.UtcNow, XmlDateTimeSerializationMode.Utc);
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.FullDate.InnerText = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:fullDate' has invalid value 'abc'. The string 'abc' is not a valid 'DateTime' value.", actual.First().Description);
element.FullDate.InnerText = "123";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1511,32 +1512,32 @@ public void EnumAttributeValidationTest()
// ***** good case ******
element.Val = FontFamilyValues.Auto;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = FontFamilyValues.Decorative;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = FontFamilyValues.Modern;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = FontFamilyValues.Roman;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = FontFamilyValues.Script;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = FontFamilyValues.Swiss;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1544,7 +1545,7 @@ public void EnumAttributeValidationTest()
Assert.EndsWith(" The Enumeration constraint failed.", actual.First().Description);
element.Val.InnerText = "Noo";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1553,7 +1554,7 @@ public void EnumAttributeValidationTest()
// Invalid character case.
element.Val.InnerText = "Auto";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1592,31 +1593,31 @@ public void EnumValueValidationTest()
// ***** good case ******
element.Text = "ArticleInAPeriodical";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "Art";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "Interview";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "Misc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Text = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Enumeration constraint failed.", actual.First().Description);
element.Text = "abc";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -1644,32 +1645,32 @@ public void StringAttributeValidationTest()
// ***** good case ******
element.Val = "010101010101";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val = null;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_MissRequiredAttribute", actual.First().Id);
element.Val = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
element.Val.InnerText = "0101";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The actual length according to data type 'string' is not equal to the specified length. The expected length is 12.", actual.First().Description);
element.Val = "0101010101010";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1677,7 +1678,7 @@ public void StringAttributeValidationTest()
// pattern invalid
element.Val = "010101010102";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1685,7 +1686,7 @@ public void StringAttributeValidationTest()
// pattern invalid
element.Val = "invalid";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Collection(
actual.OrderBy(e => e.Description, StringComparer.Ordinal),
@@ -1722,24 +1723,24 @@ public void StringAttributeValidationTest()
// ***** good case ******
var sources = new Sources();
sources.StyleName = string.Empty;
- actual = O12Validator.Validate(sources);
+ actual = O12Validator.Validate(sources, TestContext.Current.CancellationToken);
Assert.Empty(actual);
sources.StyleName = "Style1";
- actual = O12Validator.Validate(sources);
+ actual = O12Validator.Validate(sources, TestContext.Current.CancellationToken);
Assert.Empty(actual);
sources.StyleName = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
"1234567890123456789012345678901234567890123456789012345";
- actual = O12Validator.Validate(sources);
+ actual = O12Validator.Validate(sources, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
sources.StyleName = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
"1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" +
"12345678901234567890123456789012345678901234567890123456";
- actual = O12Validator.Validate(sources);
+ actual = O12Validator.Validate(sources, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1764,71 +1765,71 @@ public void StringPatternAttributeValidationTest()
// ***** good case ******
element.Text = ".1234";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = ".1234 ";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = " .1234";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = "456.1234";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Text = " 0.1234 ";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
// pattern invalid
element.Text = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
element.Text = "12";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Pattern constraint failed. The expected pattern is \\s*[0-9]*\\.[0-9]{4}\\s*.", actual.First().Description);
element.Text = "12.345";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Pattern constraint failed. The expected pattern is \\s*[0-9]*\\.[0-9]{4}\\s*.", actual.First().Description);
element.Text = "12.34567";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Pattern constraint failed. The expected pattern is \\s*[0-9]*\\.[0-9]{4}\\s*.", actual.First().Description);
element.Text = "12. 345";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Pattern constraint failed. The expected pattern is \\s*[0-9]*\\.[0-9]{4}\\s*.", actual.First().Description);
element.Text = "1 2.345";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Pattern constraint failed. The expected pattern is \\s*[0-9]*\\.[0-9]{4}\\s*.", actual.First().Description);
element.Text = "ABCD";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_ElementValueDataTypeDetailed", actual.First().Id);
@@ -1855,20 +1856,20 @@ public void NcnameAttributeValidationTest()
// ***** good case ******
var element = new CustomXmlRun();
element.Element = "a";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Element = "_b";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Element = "_b-a";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Element = "a:b";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1881,7 +1882,7 @@ public void NcnameAttributeValidationTest()
}
element.Element = strBuilder.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1906,12 +1907,12 @@ public void TokenAttributeValidationTest()
// ***** good case ******
var element = new DocPartId();
element.Val = "{6A9B8B6F-5BD2-4BC8-9F70-7020E1357FB2}";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1919,7 +1920,7 @@ public void TokenAttributeValidationTest()
// should have no internal sequences of two or more spaces
element.Val = "{6A9B8B6F- -4BC8-9F70-7020E1357FB2}";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1927,7 +1928,7 @@ public void TokenAttributeValidationTest()
// should have no leading or trailing spaces (#x20)
element.Val = " 6A9B8B6F-5BD2-4BC8-9F70-7020E1357FB2}";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1935,7 +1936,7 @@ public void TokenAttributeValidationTest()
// should not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters
element.Val = "{6A9B8B6F-5BD\x9-4BC8-9F70-7020E1357FB2}";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1943,14 +1944,14 @@ public void TokenAttributeValidationTest()
// pattern invalid
element.Val.InnerText = "1234";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The Pattern constraint failed. The expected pattern is \\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\\}.", actual.First().Description);
element.Val = "{*A9B8B6F-5BD2-4BC8-9F70-7020E1357FB2}";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1975,23 +1976,23 @@ public void HexBinaryAttributeValidationTest()
// ***** good case ******
var element = new Panose1Number();
element.Val = "1234567890ABCDEFabcd";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = "ABCDEFabcdef12345678";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
element.Val.InnerText = "1234";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -1999,7 +2000,7 @@ public void HexBinaryAttributeValidationTest()
// hexBinary must contain an even number of characters. See bug #648390
element.Val = "ABCDEFabcdef123456789";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2007,7 +2008,7 @@ public void HexBinaryAttributeValidationTest()
// too long
element.Val = "ABCDEFabcdef1234567890";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2015,7 +2016,7 @@ public void HexBinaryAttributeValidationTest()
// invalid 'X'
element.Val.InnerText = "ABCDEFabcdef1234567X";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2023,7 +2024,7 @@ public void HexBinaryAttributeValidationTest()
// invalid 'X'
element.Val.InnerText = "ABCDEFabcdefX1234567";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2039,34 +2040,34 @@ public void Base64BinaryAttributeValidationTest()
// ***** good case ******
var element = new DocumentProtection();
element.Hash = string.Empty;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Hash = "fUmpYmCMpTxTA4pfvlhKSAgB848=";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Hash = "R3k/CLjN768ujxMXkKZOuw==";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
//// ***** error case ******
element.Hash = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:hash' has invalid value '0'. The string '0' is not a valid 'http://www.w3.org/2001/XMLSchema:base64Binary' value.", actual.First().Description);
element.Hash = "R3k/CLjN768ujxMXkKZOuw==$";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:hash' has invalid value 'R3k/CLjN768ujxMXkKZOuw==$'. The string 'R3k/CLjN768ujxMXkKZOuw==$' is not a valid 'http://www.w3.org/2001/XMLSchema:base64Binary' value.", actual.First().Description);
element.Hash = "*R3k/fUmpYmCMpTxTA4pfvlhKSAgB848=";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2082,34 +2083,34 @@ public void Base64BinaryAttributeValidationTest2()
// ***** good case ******
var element = new UniqueTag();
element.Val = string.Empty;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = "fUmpYmCMpTxTA4pfvlhKSAgB848=";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = "R3k/CLjN768ujxMXkKZOuw==";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
//// ***** error case ******
element.Val = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:val' has invalid value '0'. The string '0' is not a valid 'http://www.w3.org/2001/XMLSchema:base64Binary' value.", actual.First().Description);
element.Val = "R3k/CLjN768ujxMXkKZOuw==$";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:val' has invalid value 'R3k/CLjN768ujxMXkKZOuw==$'. The string 'R3k/CLjN768ujxMXkKZOuw==$' is not a valid 'http://www.w3.org/2001/XMLSchema:base64Binary' value.", actual.First().Description);
element.Val = "*R3k/fUmpYmCMpTxTA4pfvlhKSAgB848=";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2132,47 +2133,47 @@ public void AnyUriAttributeValidationTest()
element.Priority = 1;
element.Type = string.Empty;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "http://temp";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "http://microsoft.com";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "http://a/b/c/d;p?q";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "http://a/b/c/g;x?y#s";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "<>";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "http://a/../../g";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Type = "urn:schemas-microsoft-com:office:office";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Type = "http://temp##s";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'type' has invalid value 'http://temp##s'. The string 'http://temp##s' is not a valid 'Uri' value.", actual.First().Description);
element.Type = "http:///temp";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2207,53 +2208,53 @@ public void IdStringAttributeValidationTest()
var element = new DocumentFormat.OpenXml.Office.CustomUI.Item();
element.Id = "A";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Id = "\x4E00";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Id = "A1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Id = "_";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Id = "ABCD";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Id = "ABCD_1234-XY.00";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Id = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'id' has invalid value ''. The attribute value cannot be empty.", actual.First().Description);
element.Id = "1A";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'id' has invalid value '1A'. The string '1A' is not a valid 'http://www.w3.org/2001/XMLSchema:ID' value.", actual.First().Description);
element.Id = ".B";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'id' has invalid value '.B'. The string '.B' is not a valid 'http://www.w3.org/2001/XMLSchema:ID' value.", actual.First().Description);
element.Id = "http:///temp";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2292,74 +2293,74 @@ public void QNameAttributeValidationTest()
element.AddNamespaceDeclaration("A", "http://test");
element.IdQ = "A";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.IdQ = "A:b";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.IdQ = "A1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.IdQ = "_";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.IdQ = "ABCD";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.IdQ = "ABCD_1234-XY.00";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.IdQ = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
element.IdQ = ":";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'idQ' has invalid value ':'. The string ':' is not a valid 'http://www.w3.org/2001/XMLSchema:QName' value.", actual.First().Description);
element.IdQ = ":A";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'idQ' has invalid value ':A'. The string ':A' is not a valid 'http://www.w3.org/2001/XMLSchema:QName' value.", actual.First().Description);
element.IdQ = "A:";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'idQ' has invalid value 'A:'. The string 'A:' is not a valid 'http://www.w3.org/2001/XMLSchema:QName' value.", actual.First().Description);
element.IdQ = "1A";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'idQ' has invalid value '1A'. The string '1A' is not a valid 'http://www.w3.org/2001/XMLSchema:QName' value.", actual.First().Description);
element.IdQ = ".B";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'idQ' has invalid value '.B'. The string '.B' is not a valid 'http://www.w3.org/2001/XMLSchema:QName' value.", actual.First().Description);
element.IdQ = "http:///temp";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2394,35 +2395,35 @@ public void ListAttributeValidationTest()
// ***** good case ******
row.Spans = new ListValue();
row.Spans.InnerText = "a";
- var actual = O12Validator.Validate(row);
+ var actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Empty(actual);
row.Spans.InnerText = "a a";
- actual = O12Validator.Validate(row);
+ actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Empty(actual);
row.Spans.InnerText = "abc";
- actual = O12Validator.Validate(row);
+ actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Empty(actual);
row.Spans.InnerText = "abc 123";
- actual = O12Validator.Validate(row);
+ actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Empty(actual);
row.Spans.InnerText = "abc a 123";
- actual = O12Validator.Validate(row);
+ actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
row.Spans.InnerText = string.Empty;
- actual = O12Validator.Validate(row);
+ actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
row.Spans.InnerText = " ";
- actual = O12Validator.Validate(row);
+ actual = O12Validator.Validate(row, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2434,56 +2435,56 @@ public void ListAttributeValidationTest()
// ***** good case ******
element.Start = new ListValue();
element.Start.InnerText = "1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Start.InnerText = "1 -2";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Start.InnerText = "123";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Start.InnerText = "+123 456";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Start.InnerText = "123 -4 56";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Start.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
element.Start.InnerText = "a";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'st' has invalid value 'a'.", actual.First().Description);
element.Start.InnerText = "a 1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'st' has invalid value 'a 1'.", actual.First().Description);
element.Start.InnerText = "1 a";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("The attribute 'st' has invalid value '1 a'.", actual.First().Description);
element.Start.InnerText = "1 23 4a";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2521,41 +2522,41 @@ public void UnionAttributeValidationTest()
// ***** good case ******
element.Val.InnerText = "auto";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "123456";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "FF12AB";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
Assert.EndsWith("is not valid according to any of the memberTypes of the union.", actual.First().Description);
element.Val.InnerText = "auto1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
Assert.EndsWith("is not valid according to any of the memberTypes of the union.", actual.First().Description);
element.Val.InnerText = "1234567";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
Assert.EndsWith("is not valid according to any of the memberTypes of the union.", actual.First().Description);
element.Val.InnerText = "1234";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
@@ -2589,45 +2590,45 @@ public void UnionAttributeValidationTest2()
// ***** good case ******
element.Val.InnerText = "1";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = int.MaxValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = int.MinValue.ToString();
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "-1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
Assert.EndsWith("is not valid according to any of the memberTypes of the union.", actual.First().Description);
element.Val.InnerText = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
Assert.EndsWith("is not valid according to any of the memberTypes of the union.", actual.First().Description);
element.Val.InnerText = "-0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
Assert.EndsWith("is not valid according to any of the memberTypes of the union.", actual.First().Description);
element.Val.InnerText = "ABC";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
@@ -2643,44 +2644,44 @@ public void OnOffValueValidationTest2()
Bold element = new Bold();
// ***** good case ******
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = true;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = false;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "true";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "false";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "on";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "off";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "1";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val.InnerText = "0";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.Val.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2688,7 +2689,7 @@ public void OnOffValueValidationTest2()
Assert.EndsWith(" The attribute value cannot be empty.", actual.First().Description);
element.Val.InnerText = "Noo";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2697,7 +2698,7 @@ public void OnOffValueValidationTest2()
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:val' has invalid value 'Noo'. The Enumeration constraint failed.", actual.First().Description);
element.Val.InnerText = "On";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2706,7 +2707,7 @@ public void OnOffValueValidationTest2()
Assert.Equal("The attribute 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:val' has invalid value 'On'. The Enumeration constraint failed.", actual.First().Description);
element.Val.InnerText = "False";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2741,40 +2742,40 @@ public void TrueFalseBlankValueValidationTest2()
var element = new DocumentFormat.OpenXml.Vml.ShapeHandle();
// ***** good case ******
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX = true;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX = false;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX.InnerText = "true";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX.InnerText = "false";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX.InnerText = "t";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX.InnerText = "f";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.InvertX.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
element.InvertX.InnerText = "Noo";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2783,7 +2784,7 @@ public void TrueFalseBlankValueValidationTest2()
Assert.Equal("The attribute 'invx' has invalid value 'Noo'. The Enumeration constraint failed.", actual.First().Description);
element.InvertX.InnerText = "True";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2792,7 +2793,7 @@ public void TrueFalseBlankValueValidationTest2()
Assert.Equal("The attribute 'invx' has invalid value 'True'. The Enumeration constraint failed.", actual.First().Description);
element.InvertX.InnerText = "F";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -2814,11 +2815,11 @@ public void SpreadsheetDocumentValidatingTest()
using (var stream = GetStream(TestFiles.Basicspreadsheet))
using (var sdoc = SpreadsheetDocument.Open(stream, false))
{
- var o12actual = O12Validator.Validate(sdoc);
+ var o12actual = O12Validator.Validate(sdoc, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(sdoc);
+ var o14actual = O14Validator.Validate(sdoc, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -2833,11 +2834,11 @@ public void WordprocessingDocumentValidatingTest()
using (WordprocessingDocument wordTestDocument = WordprocessingDocument.Open(stream, false))
{
// TODO: Abstract for version
- var o12actual = O12Validator.Validate(wordTestDocument);
+ var o12actual = O12Validator.Validate(wordTestDocument, TestContext.Current.CancellationToken);
Assert.Single(o12actual); // The value 'actual' should contain one validation error for 'doNotEmbedSmartTags' in the test document.
// Office2010
- var o14actual = O14Validator.Validate(wordTestDocument);
+ var o14actual = O14Validator.Validate(wordTestDocument, TestContext.Current.CancellationToken);
Assert.Single(o14actual); // The value 'actual' should contain one validation error for 'doNotEmbedSmartTags' in the test document.
}
}
@@ -2854,13 +2855,13 @@ public void Wordprocessing2010DocumentValidatingTest()
using (WordprocessingDocument wordTestDocument = WordprocessingDocument.Open(stream, false))
{
IEnumerable actual;
- actual = O12Validator.Validate(wordTestDocument);
+ actual = O12Validator.Validate(wordTestDocument, TestContext.Current.CancellationToken);
// There are Office2010 elements and attributes in the document, so there are should validation errors.
Assert.Equal(34, actual.Count()); // The value 'actual' should contain 34 validation error including 'doNotEmbedSmartTags' in the test document.
// Office2010
- actual = O14Validator.Validate(wordTestDocument);
+ actual = O14Validator.Validate(wordTestDocument, TestContext.Current.CancellationToken);
Assert.Single(actual); // The value 'actual' should contain one validation error for 'doNotEmbedSmartTags' in the test document.
}
}
@@ -2876,8 +2877,8 @@ public void PresentationDocumentValidatingTest()
using (var pDoc = PresentationDocument.Open(stream, false))
{
// use stream
- Assert.Empty(O12Validator.Validate(pDoc));
- Assert.Empty(O14Validator.Validate(pDoc));
+ Assert.Empty(O12Validator.Validate(pDoc, TestContext.Current.CancellationToken));
+ Assert.Empty(O14Validator.Validate(pDoc, TestContext.Current.CancellationToken));
}
}
@@ -2891,11 +2892,11 @@ public void SpreadsheetPartValidatingTest()
using (var testDocument = SpreadsheetDocument.Open(stream, false))
{
// validate the workbook part only.
- var o12actual = O12Validator.Validate(testDocument.WorkbookPart);
+ var o12actual = O12Validator.Validate(testDocument.WorkbookPart, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.WorkbookPart);
+ var o14actual = O14Validator.Validate(testDocument.WorkbookPart, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -2910,11 +2911,11 @@ public void WordprocessingPartValidatingTest()
using (var testDocument = WordprocessingDocument.Open(stream, false))
{
// validate the main document part only
- var o12actual = O12Validator.Validate(testDocument.MainDocumentPart);
+ var o12actual = O12Validator.Validate(testDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.MainDocumentPart);
+ var o14actual = O14Validator.Validate(testDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -2929,11 +2930,11 @@ public void Wordprocessing2010PartValidatingTest()
using (var testDocument = WordprocessingDocument.Open(stream, false))
{
// validate the StyleDefinitionsPart
- var o12actual = O12Validator.Validate(testDocument.MainDocumentPart.StyleDefinitionsPart);
+ var o12actual = O12Validator.Validate(testDocument.MainDocumentPart.StyleDefinitionsPart, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.MainDocumentPart.StyleDefinitionsPart);
+ var o14actual = O14Validator.Validate(testDocument.MainDocumentPart.StyleDefinitionsPart, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
// can not validate the StylesWithEffectsPart against Office2007
@@ -2941,7 +2942,7 @@ public void Wordprocessing2010PartValidatingTest()
// Assert.Equal(0, actual.Count());
// Office2010
- var o14effectsActual = O14Validator.Validate(testDocument.MainDocumentPart.StylesWithEffectsPart);
+ var o14effectsActual = O14Validator.Validate(testDocument.MainDocumentPart.StylesWithEffectsPart, TestContext.Current.CancellationToken);
Assert.Empty(o14effectsActual);
}
}
@@ -2956,11 +2957,11 @@ public void SlidePartValidatingTest()
using (var testDocument = PresentationDocument.Open(stream, false))
{
// validate one Slide part only
- var o12actual = O12Validator.Validate(testDocument.PresentationPart.SlideParts.First());
+ var o12actual = O12Validator.Validate(testDocument.PresentationPart.SlideParts.First(), TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.PresentationPart.SlideParts.First());
+ var o14actual = O14Validator.Validate(testDocument.PresentationPart.SlideParts.First(), TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -2975,11 +2976,11 @@ public void SpreadsheetElementValidatingTest()
using (var testDocument = SpreadsheetDocument.Open(stream, false))
{
// validate the workbook part only.
- var o12actual = O12Validator.Validate(testDocument.WorkbookPart.Workbook);
+ var o12actual = O12Validator.Validate(testDocument.WorkbookPart.Workbook, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.WorkbookPart.Workbook);
+ var o14actual = O14Validator.Validate(testDocument.WorkbookPart.Workbook, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -2994,11 +2995,11 @@ public void WordprocessingElementValidatingTest()
using (var testDocument = WordprocessingDocument.Open(stream, false))
{
// validate the main document part only
- var o12actual = O12Validator.Validate(testDocument.MainDocumentPart.Document);
+ var o12actual = O12Validator.Validate(testDocument.MainDocumentPart.Document, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.MainDocumentPart.Document);
+ var o14actual = O14Validator.Validate(testDocument.MainDocumentPart.Document, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -3013,11 +3014,11 @@ public void SlideElementValidatingTest()
using (var testDocument = PresentationDocument.Open(stream, false))
{
// validate the Slide element
- var o12actual = O12Validator.Validate(testDocument.PresentationPart.SlideParts.First().Slide);
+ var o12actual = O12Validator.Validate(testDocument.PresentationPart.SlideParts.First().Slide, TestContext.Current.CancellationToken);
Assert.Empty(o12actual);
// Office2010
- var o14actual = O14Validator.Validate(testDocument.PresentationPart.SlideParts.First().Slide);
+ var o14actual = O14Validator.Validate(testDocument.PresentationPart.SlideParts.First().Slide, TestContext.Current.CancellationToken);
Assert.Empty(o14actual);
}
}
@@ -3039,14 +3040,14 @@ public void PartValidatingTest()
IEnumerable actual;
// validate the element
- actual = O12Validator.Validate(paragraph);
+ actual = O12Validator.Validate(paragraph, TestContext.Current.CancellationToken);
Assert.Single(actual);
var error = actual.First();
Assert.Null(error.Part);
Assert.Same(paragraph, error.Node);
mainDocPart.Document = document;
- actual = O12Validator.Validate(paragraph);
+ actual = O12Validator.Validate(paragraph, TestContext.Current.CancellationToken);
Assert.Single(actual);
error = actual.First();
Assert.Same(mainDocPart, error.Part); // should return the part.
@@ -3085,7 +3086,7 @@ public void PackageStructureValidatingTest()
using (WordprocessingDocument loadedDoc = WordprocessingDocument.Open(stream, false))
{
- var errors = validator.Validate(loadedDoc);
+ var errors = validator.Validate(loadedDoc, TestContext.Current.CancellationToken);
Assert.Equal(2, errors.Count());
Assert.Collection(
@@ -3117,7 +3118,7 @@ public void PackageStructureValidatingTest()
presettationPart.Presentation.Save();
// must have a SlideMasterPart.
- var errors = validator.Validate(pptdoc);
+ var errors = validator.Validate(pptdoc, TestContext.Current.CancellationToken);
Assert.Equal(2, errors.Count());
var first = errors.First();
@@ -3153,7 +3154,7 @@ public void InvalidXmlInPartValidatingTest()
}
OpenXmlValidator validator = new OpenXmlValidator();
- var errors = validator.Validate(commentsPart);
+ var errors = validator.Validate(commentsPart, TestContext.Current.CancellationToken);
Assert.Equal(2, errors.Count());
commentsPart.UnloadRootElement();
@@ -3163,7 +3164,7 @@ public void InvalidXmlInPartValidatingTest()
sw.WriteLine("", comments.NamespaceUri);
}
- errors = validator.Validate(commentsPart);
+ errors = validator.Validate(commentsPart, TestContext.Current.CancellationToken);
Assert.Single(errors);
Assert.Same(commentsPart, errors.First().Part);
Assert.Equal("ExceptionError", errors.First().Id);
@@ -3184,37 +3185,37 @@ public void MaxErrorsTest()
IEnumerable actual;
// validate the main document part only
- actual = O12Validator.Validate(testDocument);
+ actual = O12Validator.Validate(testDocument, TestContext.Current.CancellationToken);
Assert.Equal(5, actual.Count());
- actual = O12Validator.Validate(testDocument.MainDocumentPart);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Equal(2, actual.Count());
- actual = O12Validator.Validate(testDocument.MainDocumentPart.Document);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart.Document, TestContext.Current.CancellationToken);
Assert.Equal(2, actual.Count());
int savedMaxErrors = O12Validator.MaxNumberOfErrors;
O12Validator.MaxNumberOfErrors = 4;
- actual = O12Validator.Validate(testDocument);
+ actual = O12Validator.Validate(testDocument, TestContext.Current.CancellationToken);
Assert.Equal(4, actual.Count());
- actual = O12Validator.Validate(testDocument.MainDocumentPart);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Equal(2, actual.Count());
- actual = O12Validator.Validate(testDocument.MainDocumentPart.Document);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart.Document, TestContext.Current.CancellationToken);
Assert.Equal(2, actual.Count());
O12Validator.MaxNumberOfErrors = 3;
- actual = O12Validator.Validate(testDocument);
+ actual = O12Validator.Validate(testDocument, TestContext.Current.CancellationToken);
Assert.Equal(3, actual.Count());
- actual = O12Validator.Validate(testDocument.MainDocumentPart);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Equal(2, actual.Count());
- actual = O12Validator.Validate(testDocument.MainDocumentPart.Document);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart.Document, TestContext.Current.CancellationToken);
Assert.Equal(2, actual.Count());
O12Validator.MaxNumberOfErrors = 1;
- actual = O12Validator.Validate(testDocument);
+ actual = O12Validator.Validate(testDocument, TestContext.Current.CancellationToken);
Assert.Single(actual);
- actual = O12Validator.Validate(testDocument.MainDocumentPart);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Single(actual);
- actual = O12Validator.Validate(testDocument.MainDocumentPart.Document);
+ actual = O12Validator.Validate(testDocument.MainDocumentPart.Document, TestContext.Current.CancellationToken);
Assert.Single(actual);
O12Validator.MaxNumberOfErrors = savedMaxErrors;
@@ -3239,7 +3240,7 @@ public void DspInDiagramTest()
new DocumentFormat.OpenXml.Office.Drawing.GroupShapeProperties());
// ***** good case ******
- var actual = O14Validator.Validate(element);
+ var actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
}
@@ -3258,7 +3259,7 @@ public void ExpectedExceptionOnValidate1Test()
wordDoc.AddMainDocumentPart();
wordDoc.MainDocumentPart.AddNewPart();
- var actual = O12Validator.Validate(wordDoc.MainDocumentPart.StylesWithEffectsPart);
+ var actual = O12Validator.Validate(wordDoc.MainDocumentPart.StylesWithEffectsPart, TestContext.Current.CancellationToken);
}
}
});
@@ -3273,7 +3274,7 @@ public void ExpectedExceptionOnValidate2Test()
Assert.Throws(() =>
{
var o14Element = new DocumentFormat.OpenXml.Wordprocessing.StartBorder();
- var actual = O12Validator.Validate(o14Element);
+ var actual = O12Validator.Validate(o14Element, TestContext.Current.CancellationToken);
});
}
@@ -3301,12 +3302,12 @@ public void O14SchemaConstraintDataTest()
var borders = new DocumentFormat.OpenXml.Wordprocessing.TableBorders();
borders.TopBorder = new DocumentFormat.OpenXml.Wordprocessing.TopBorder() { Val = BorderValues.Apples };
- var actual = O12Validator.Validate(borders);
+ var actual = O12Validator.Validate(borders, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// add an O14 child
borders.StartBorder = new StartBorder() { Val = BorderValues.ArchedScallops };
- actual = O12Validator.Validate(borders);
+ actual = O12Validator.Validate(borders, TestContext.Current.CancellationToken);
// should report error in O12
Assert.Single(actual);
@@ -3317,12 +3318,12 @@ public void O14SchemaConstraintDataTest()
Assert.DoesNotContain(ValidationErrorStrings.FmtListOfPossibleElements, actual.First().Description);
// should not report error in O14
- actual = O14Validator.Validate(borders);
+ actual = O14Validator.Validate(borders, TestContext.Current.CancellationToken);
Assert.Empty(actual);
borders.RightBorder = new DocumentFormat.OpenXml.Wordprocessing.RightBorder() { Val = BorderValues.BabyPacifier };
- actual = O12Validator.Validate(borders);
+ actual = O12Validator.Validate(borders, TestContext.Current.CancellationToken);
// should report error in O12
Assert.Single(actual);
@@ -3333,12 +3334,12 @@ public void O14SchemaConstraintDataTest()
Assert.DoesNotContain(ValidationErrorStrings.FmtListOfPossibleElements, actual.First().Description);
// should not report error in O14
- actual = O14Validator.Validate(borders);
+ actual = O14Validator.Validate(borders, TestContext.Current.CancellationToken);
Assert.Empty(actual);
borders.EndBorder = new EndBorder() { Val = BorderValues.Cabins };
- actual = O12Validator.Validate(borders);
+ actual = O12Validator.Validate(borders, TestContext.Current.CancellationToken);
// should report error in O12
Assert.Single(actual);
@@ -3349,14 +3350,14 @@ public void O14SchemaConstraintDataTest()
Assert.DoesNotContain(ValidationErrorStrings.FmtListOfPossibleElements, actual.First().Description);
// should not report error in O14
- actual = O14Validator.Validate(borders);
+ actual = O14Validator.Validate(borders, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// remove a required attribute from the O14 element.
borders.EndBorder.Val = null;
// should report attribute error in O14
- actual = O14Validator.Validate(borders);
+ actual = O14Validator.Validate(borders, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Same(borders.EndBorder, actual.First().Node);
Assert.Null(actual.First().RelatedNode);
@@ -3376,59 +3377,59 @@ public void EnumValidationO14SupportTest()
// the following values are valid in both Office2007 and Office2010.
element.Val = BorderValues.Apples;
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = BorderValues.BabyPacifier;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = BorderValues.Cabins;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = BorderValues.DashDotStroked;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = BorderValues.Earth1;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Val = BorderValues.Fans;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
// following are invalid for both Office2007 and Office2010
element.Val.InnerText = string.Empty;
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("/w:left[1]", actual.First().Path.XPath);
Assert.EndsWith(" The Enumeration constraint failed.", actual.First().Description);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -3436,14 +3437,14 @@ public void EnumValidationO14SupportTest()
Assert.EndsWith(" The Enumeration constraint failed.", actual.First().Description);
element.Val.InnerText = "Noo";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("/w:left[1]", actual.First().Path.XPath);
Assert.EndsWith(" The Enumeration constraint failed.", actual.First().Description);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -3452,14 +3453,14 @@ public void EnumValidationO14SupportTest()
// Invalid character case.
element.Val.InnerText = "Dashed"; // the correct value is "dashed"
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("/w:left[1]", actual.First().Path.XPath);
Assert.EndsWith(" The Enumeration constraint failed.", actual.First().Description);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
@@ -3471,7 +3472,7 @@ public void EnumValidationO14SupportTest()
// should report error in O12 validator.
// In M5, the enum is also available in O12
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
@@ -3480,7 +3481,7 @@ public void EnumValidationO14SupportTest()
// Assert.True(actual.First().Description.EndsWith(" The Enumeration constraint failed."));
// should not report error in O14 validator.
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
}
@@ -3496,30 +3497,30 @@ public void AttributeValidationO14SupportTest()
// the following attributes are valid in both Office2007 and Office2010.
element.Left = "10";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
element.Right = "20";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
// following are invalid for both Office2007 and Office2010
element.SetAttribute(new OpenXmlAttribute("foo", "bar", "http://foo", "egg"));
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
Assert.Equal("/w:ind[1]", actual.First().Path.XPath);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
@@ -3530,7 +3531,7 @@ public void AttributeValidationO14SupportTest()
element.Start = "10";
// should report error in Office2007 validator.
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
@@ -3538,7 +3539,7 @@ public void AttributeValidationO14SupportTest()
Assert.Equal("The 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:start' attribute is not declared.", actual.First().Description);
// should NOT report error in Office2010 validator.
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// The w:start only valid in Office2010.
@@ -3546,7 +3547,7 @@ public void AttributeValidationO14SupportTest()
element.Start.InnerText = "Foo";
// should report Sch_UndeclaredAttribute error in Office2007 validator.
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
@@ -3554,7 +3555,7 @@ public void AttributeValidationO14SupportTest()
Assert.Equal("The 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:start' attribute is not declared.", actual.First().Description);
// should report Sch_AttributeUnionFailedEx error in Office2010 validator.
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
@@ -3582,23 +3583,23 @@ public void ChangedAttributeValueTypeValidationO14SupportTest()
// the following attributes are valid in both Office2007 and Office2010.
element.Percent = "10";
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** error case ******
// following are invalid for both Office2007 and Office2010
element.Percent = "foo";
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("/w:zoom[1]", actual.First().Path.XPath);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeUnionFailedEx", actual.First().Id);
@@ -3608,14 +3609,14 @@ public void ChangedAttributeValueTypeValidationO14SupportTest()
element.Percent = "10%";
// should report error in Office2007 validator.
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
Assert.Equal("/w:zoom[1]", actual.First().Path.XPath);
// should NOT report error in Office2010 validator.
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
}
@@ -3632,23 +3633,23 @@ public void SchemaValidationO14SupportTest2()
// the following attributes are valid in both Office2007 and Office2010.
element.Val = "FF00";
- var actual = O12Validator.Validate(tblPr);
+ var actual = O12Validator.Validate(tblPr, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(tblPr);
+ actual = O14Validator.Validate(tblPr, TestContext.Current.CancellationToken);
Assert.Empty(actual);
//// ***** error case ******
//// following are invalid for both Office2007 and Office2010
element.SetAttribute(new OpenXmlAttribute("foo", "bar", "http://foo", "egg"));
- actual = O12Validator.Validate(tblPr);
+ actual = O12Validator.Validate(tblPr, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
Assert.Equal("/w:tblPr[1]/w:tblLook[1]", actual.First().Path.XPath);
- actual = O14Validator.Validate(tblPr);
+ actual = O14Validator.Validate(tblPr, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
@@ -3659,7 +3660,7 @@ public void SchemaValidationO14SupportTest2()
element.FirstRow = true;
// should report error in Office2007 validator.
- actual = O12Validator.Validate(tblPr);
+ actual = O12Validator.Validate(tblPr, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
Assert.Equal("Sch_UndeclaredAttribute", actual.First().Id);
@@ -3667,24 +3668,24 @@ public void SchemaValidationO14SupportTest2()
Assert.Equal("The 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:firstRow' attribute is not declared.", actual.First().Description);
// should NOT report error in Office2010 validator.
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// ***** good case ******
var compat = new Compatibility();
compat.AdjustLineHeightInTable = new AdjustLineHeightInTable();
- actual = O12Validator.Validate(compat);
+ actual = O12Validator.Validate(compat, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(compat);
+ actual = O14Validator.Validate(compat, TestContext.Current.CancellationToken);
Assert.Empty(actual);
//// ***** error case ******
// The CompatibilitySetting only valid in Office2010.
var o14element = compat.AppendChild(new CompatibilitySetting() { Name = CompatSettingNameValues.CompatibilityMode, Uri = "foo", Val = "12" });
- actual = O12Validator.Validate(compat);
+ actual = O12Validator.Validate(compat, TestContext.Current.CancellationToken);
// should report error in O12
// In M5, it is also avalilabe in O12, so disable this block
@@ -3696,13 +3697,13 @@ public void SchemaValidationO14SupportTest2()
// Assert.Equal("Sch_UnexpectedElementContentExpectingComplex", actual.First().Id);
// should not report error in O14
- actual = O14Validator.Validate(compat);
+ actual = O14Validator.Validate(compat, TestContext.Current.CancellationToken);
Assert.Empty(actual);
// append
var errorElement = compat.AppendChild(new CachedColumnBalance());
- actual = O12Validator.Validate(compat);
+ actual = O12Validator.Validate(compat, TestContext.Current.CancellationToken);
// should report error in O12
Assert.Single(actual);
@@ -3713,7 +3714,7 @@ public void SchemaValidationO14SupportTest2()
Assert.DoesNotContain(ValidationErrorStrings.FmtListOfPossibleElements, actual.First().Description);
// should report error in O14 because the last element is our of order.
- actual = O14Validator.Validate(compat);
+ actual = O14Validator.Validate(compat, TestContext.Current.CancellationToken);
Assert.Single(actual);
Assert.Same(compat, actual.First().Node);
Assert.Same(errorElement, actual.First().RelatedNode);
@@ -3734,10 +3735,10 @@ public void SchemaValidationOnMcAttributeTest()
var element = new Document(xml);
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
}
@@ -3761,7 +3762,7 @@ public void NamespaceTest()
p.ParagraphId = "0000FFFF";
Assert.NotNull(p.ParagraphId);
- var actual = O12Validator.Validate(element);
+ var actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Collection(actual, e =>
{
@@ -3772,7 +3773,7 @@ public void NamespaceTest()
Assert.Equal("/w:document[1]/w:body[1]/w:p[1]", e.Path.XPath);
});
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
string outerxml = element.OuterXml;
@@ -3781,10 +3782,10 @@ public void NamespaceTest()
Assert.Null(p.TextId);
Assert.NotNull(p.ParagraphId);
- actual = O12Validator.Validate(element);
+ actual = O12Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Single(actual);
- actual = O14Validator.Validate(element);
+ actual = O14Validator.Validate(element, TestContext.Current.CancellationToken);
Assert.Empty(actual);
}
@@ -3804,13 +3805,13 @@ public void VersionMismatchValidatingTest()
IEnumerable actual;
// Office2010
- actual = O14Validator.Validate(wordTestDocument);
+ actual = O14Validator.Validate(wordTestDocument, TestContext.Current.CancellationToken);
Assert.Single(actual); // The value 'actual' should contain one validation error for 'doNotEmbedSmartTags' in the test document.
// the following line should throw exception.
Assert.Throws(() =>
{
- actual = O12Validator.Validate(wordTestDocument);
+ actual = O12Validator.Validate(wordTestDocument, TestContext.Current.CancellationToken);
});
}
}
@@ -3825,10 +3826,10 @@ public void VersionMismatchPartValidatingTest()
using (Stream stream = GetStream(TestFiles.Complex0docx))
using (WordprocessingDocument wordTestDocument = WordprocessingDocument.Open(stream, false, new OpenSettings() { MarkupCompatibilityProcessSettings = new MarkupCompatibilityProcessSettings(MarkupCompatibilityProcessMode.ProcessAllParts, FileFormatVersions.Office2007) }))
{
- var actual = O12Validator.Validate(wordTestDocument.MainDocumentPart);
+ var actual = O12Validator.Validate(wordTestDocument.MainDocumentPart, TestContext.Current.CancellationToken);
Assert.Empty(actual);
- Assert.Throws(() => O14Validator.Validate(wordTestDocument.MainDocumentPart));
+ Assert.Throws(() => O14Validator.Validate(wordTestDocument.MainDocumentPart, TestContext.Current.CancellationToken));
}
}
}
diff --git a/test/DocumentFormat.OpenXml.Tests/ofapiTest/SemanticValidationTest.cs b/test/DocumentFormat.OpenXml.Tests/ofapiTest/SemanticValidationTest.cs
index 199bbffe5..1f7f11cb4 100644
--- a/test/DocumentFormat.OpenXml.Tests/ofapiTest/SemanticValidationTest.cs
+++ b/test/DocumentFormat.OpenXml.Tests/ofapiTest/SemanticValidationTest.cs
@@ -40,12 +40,12 @@ public void Category1_14Test()
TableColumn column = new TableColumn();
column.TotalsRowFunction = TotalsRowFunctionValues.Custom;
- Assert.False(ErrorShowsUp(o12Validator.Validate(column), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
- Assert.False(ErrorShowsUp(o14Validator.Validate(column), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
+ Assert.False(ErrorShowsUp(o12Validator.Validate(column, TestContext.Current.CancellationToken), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
+ Assert.False(ErrorShowsUp(o14Validator.Validate(column, TestContext.Current.CancellationToken), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
column.TotalsRowLabel = "somevalue";
- Assert.True(ErrorShowsUp(o12Validator.Validate(column), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
- Assert.True(ErrorShowsUp(o14Validator.Validate(column), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
+ Assert.True(ErrorShowsUp(o12Validator.Validate(column, TestContext.Current.CancellationToken), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
+ Assert.True(ErrorShowsUp(o14Validator.Validate(column, TestContext.Current.CancellationToken), "Attribute 'totalsRowLabel' should be absent when the value of attribute 'totalsRowFunction' is 'custom'."));
}
///
@@ -57,7 +57,7 @@ public void UT4Bug683087()
DocumentFormat.OpenXml.Spreadsheet.ServerFormat sf = new DocumentFormat.OpenXml.Spreadsheet.ServerFormat();
sf.Culture = "test";
sf.Format = "test";
- var errors = new OpenXmlValidator(FileFormatVersions.Office2010).Validate(sf);
+ var errors = new OpenXmlValidator(FileFormatVersions.Office2010).Validate(sf, TestContext.Current.CancellationToken);
Assert.Single(errors);
}
diff --git a/test/DocumentFormat.OpenXml.Tests/ofapiTest/ValidatorCancellationExtensions.cs b/test/DocumentFormat.OpenXml.Tests/ofapiTest/ValidatorCancellationExtensions.cs
new file mode 100644
index 000000000..f9f935930
--- /dev/null
+++ b/test/DocumentFormat.OpenXml.Tests/ofapiTest/ValidatorCancellationExtensions.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+#if FEATURE_NO_VALIDATOR_CANCELLATIONTOKEN
+
+using DocumentFormat.OpenXml.Packaging;
+using DocumentFormat.OpenXml.Validation;
+using System.Collections.Generic;
+
+namespace DocumentFormat.OpenXml.Tests;
+
+///
+/// Used for tests that cross compile and need to pass in a cancellation token. Since this is shadowed currently in the .NET 3.5 builds,
+/// we take the token as an object since we don't need to do anything besides compile.
+///
+internal static class ValidatorCancellationExtensions
+{
+ internal static IEnumerable Validate(this OpenXmlValidator validator, OpenXmlPackage package, object token)
+ => validator.Validate(package);
+
+ internal static IEnumerable Validate(this OpenXmlValidator validator, OpenXmlElement element, object token)
+ => validator.Validate(element);
+
+ internal static IEnumerable Validate(this OpenXmlValidator validator, OpenXmlPart part, object token)
+ => validator.Validate(part);
+}
+
+#endif