Skip to content

Commit 94ae24c

Browse files
authored
Merge pull request #48 from xmlunit/readmes-for-packages
add readmes to nuget packages
2 parents db3f1e9 + 3daf73d commit 94ae24c

File tree

11 files changed

+347
-0
lines changed

11 files changed

+347
-0
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## XMLUnit.NET 2.11.1 - /Not Released, yet/
44

5+
* added readme files for the nuget packages.
6+
Issue [#46](https://github.com/xmlunit/xmlunit.net/issues/46).
7+
58
* the NUnit 4.x constraints package tags nunit3 rather than nunit4.
69
PR [#43](https://github.com/xmlunit/xmlunit.net/issues/43).
710

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# XMLUnit.NET NUnit 2.x Constraints
2+
3+
XMLUnit provides you with the tools to verify the XML you emit is the
4+
one you want to create.
5+
6+
This package provides Constraints on top of the XMLUnit.NET core
7+
library to be used with NUnit 2.x. If you are using a different
8+
version of NUUnit, please use the package for your version.
9+
10+
* [XMLUnit.Core - Core Library ![nuget](https://img.shields.io/nuget/v/XMLUnit.Core.svg)](https://www.nuget.org/packages/XMLUnit.Core/)
11+
* [XMLUnit.NUnit3.Constraints - Constraints for NUnit 3.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit3.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit3.Constraints/)
12+
* [XMLUnit.NUnit4.Constraints - Constraints for NUnit 4.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit4.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit4.Constraints/)
13+
14+
[![Build status](https://ci.appveyor.com/api/projects/status/am34dfbr4vbcarr3?svg=true)]
15+
16+
## Requirements
17+
18+
XMLUnit requires .NET Standard 2.0 (tested with .NET 8 rigt now) and
19+
should still support .NET Framework 3.5 and Mono.
20+
21+
This Constraints package requires NUnit 2.x and XMLUnit.Core.
22+
23+
## Usage
24+
25+
These are some really small examples, more is available as part of the
26+
[user guide](https://github.com/xmlunit/user-guide/wiki)
27+
28+
### Comparing Two Documents
29+
30+
```csharp
31+
Assert.That(CreateTestDocument(), CompareConstraint.IsIdenticalTo(Input.FromFile("test-data/good.xml")));
32+
```
33+
34+
### Asserting an XPath Value
35+
36+
```csharp
37+
Assert.That("<foo>bar</foo>", HasXPathConstraint.HasXPath("/foo"));
38+
Assert.That("<foo>bar</foo>", EvaluateXPathConstraint.HasXPath("/foo/text()",
39+
```
40+
41+
### Validating a Document Against an XML Schema
42+
43+
44+
```csharp
45+
Assert.That(CreateDocument(),
46+
new ValidationConstraint(Input.FromFile("local.xsd")));
47+
```
48+
49+
## Additional Documentation
50+
51+
XMLUnit.NET is developed at
52+
[github](https://github.com/xmlunit/xmlunit.net). More documentation,
53+
releases and an issue tracker can be found there.
54+
55+
## Changelog
56+
57+
See the [Release
58+
Notes](https://github.com/xmlunit/xmlunit.net/blob/main/RELEASE_NOTES.md)
59+
at github.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# XMLUnit.NET NUnit 3.x Constraints
2+
3+
XMLUnit provides you with the tools to verify the XML you emit is the
4+
one you want to create.
5+
6+
This package provides Constraints on top of the XMLUnit.NET core
7+
library to be used with NUnit 3.x. If you are using a different
8+
version of NUUnit, please use the package for your version.
9+
10+
* [XMLUnit.Core - Core Library ![nuget](https://img.shields.io/nuget/v/XMLUnit.Core.svg)](https://www.nuget.org/packages/XMLUnit.Core/)
11+
* [XMLUnit.NUnit2.Constraints - Constraints for NUnit 2.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit2.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit2.Constraints/)
12+
* [XMLUnit.NUnit4.Constraints - Constraints for NUnit 4.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit4.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit4.Constraints/)
13+
14+
[![Build status](https://ci.appveyor.com/api/projects/status/am34dfbr4vbcarr3?svg=true)]
15+
16+
## Requirements
17+
18+
XMLUnit requires .NET Standard 2.0 (tested with .NET 8 rigt now) and
19+
should still support .NET Framework 3.5 and Mono.
20+
21+
This Constraints package requires NUnit 3.x and XMLUnit.Core.
22+
23+
## Usage
24+
25+
These are some really small examples, more is available as part of the
26+
[user guide](https://github.com/xmlunit/user-guide/wiki)
27+
28+
### Comparing Two Documents
29+
30+
```csharp
31+
Assert.That(CreateTestDocument(), CompareConstraint.IsIdenticalTo(Input.FromFile("test-data/good.xml")));
32+
```
33+
34+
### Asserting an XPath Value
35+
36+
```csharp
37+
Assert.That("<foo>bar</foo>", HasXPathConstraint.HasXPath("/foo"));
38+
Assert.That("<foo>bar</foo>", EvaluateXPathConstraint.HasXPath("/foo/text()",
39+
```
40+
41+
### Validating a Document Against an XML Schema
42+
43+
44+
```csharp
45+
Assert.That(CreateDocument(),
46+
new ValidationConstraint(Input.FromFile("local.xsd")));
47+
```
48+
49+
## Additional Documentation
50+
51+
XMLUnit.NET is developed at
52+
[github](https://github.com/xmlunit/xmlunit.net). More documentation,
53+
releases and an issue tracker can be found there.
54+
55+
## Changelog
56+
57+
See the [Release
58+
Notes](https://github.com/xmlunit/xmlunit.net/blob/main/RELEASE_NOTES.md)
59+
at github.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# XMLUnit.NET NUnit 4.x Constraints
2+
3+
XMLUnit provides you with the tools to verify the XML you emit is the
4+
one you want to create.
5+
6+
This package provides Constraints on top of the XMLUnit.NET core
7+
library to be used with NUnit 4.x. If you are using a different
8+
version of NUUnit, please use the package for your version.
9+
10+
* [XMLUnit.Core - Core Library ![nuget](https://img.shields.io/nuget/v/XMLUnit.Core.svg)](https://www.nuget.org/packages/XMLUnit.Core/)
11+
* [XMLUnit.NUnit2.Constraints - Constraints for NUnit 2.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit2.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit2.Constraints/)
12+
* [XMLUnit.NUnit3.Constraints - Constraints for NUnit 3.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit3.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit3.Constraints/)
13+
14+
[![Build status](https://ci.appveyor.com/api/projects/status/am34dfbr4vbcarr3?svg=true)]
15+
16+
## Requirements
17+
18+
XMLUnit requires .NET Standard 2.0 (tested with .NET 8 rigt now) and
19+
should still support .NET Framework 3.5 and Mono.
20+
21+
This Constraints package requires NUnit 4.x and XMLUnit.Core.
22+
23+
## Usage
24+
25+
These are some really small examples, more is available as part of the
26+
[user guide](https://github.com/xmlunit/user-guide/wiki)
27+
28+
### Comparing Two Documents
29+
30+
```csharp
31+
Assert.That(CreateTestDocument(), CompareConstraint.IsIdenticalTo(Input.FromFile("test-data/good.xml")));
32+
```
33+
34+
### Asserting an XPath Value
35+
36+
```csharp
37+
Assert.That("<foo>bar</foo>", HasXPathConstraint.HasXPath("/foo"));
38+
Assert.That("<foo>bar</foo>", EvaluateXPathConstraint.HasXPath("/foo/text()",
39+
```
40+
41+
### Validating a Document Against an XML Schema
42+
43+
44+
```csharp
45+
Assert.That(CreateDocument(),
46+
new ValidationConstraint(Input.FromFile("local.xsd")));
47+
```
48+
49+
## Additional Documentation
50+
51+
XMLUnit.NET is developed at
52+
[github](https://github.com/xmlunit/xmlunit.net). More documentation,
53+
releases and an issue tracker can be found there.
54+
55+
## Changelog
56+
57+
See the [Release
58+
Notes](https://github.com/xmlunit/xmlunit.net/blob/main/RELEASE_NOTES.md)
59+
at github.

src/doc/readmes/net-core/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# XMLUnit.NET
2+
3+
XMLUnit provides you with the tools to verify the XML you emit is the
4+
one you want to create.
5+
6+
It provides helpers to validate against an XML Schema, assert the
7+
values of XPath queries or compare XML documents against expected
8+
outcomes.
9+
10+
This package provides the core functionality and can be used
11+
stand-alone. In addition there are libraries providing NUnit
12+
constraints and a "placeholders" package that may simplify writing
13+
comparison tests in certain cases.
14+
15+
* [XMLUnit.NUnit2.Constraints - Constraints for NUnit 2.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit2.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit2.Constraints/)
16+
* [XMLUnit.NUnit3.Constraints - Constraints for NUnit 3.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit3.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit3.Constraints/)
17+
* [XMLUnit.NUnit4.Constraints - Constraints for NUnit 4.x ![nuget](https://img.shields.io/nuget/v/XMLUnit.NUnit4.Constraints.svg)](https://www.nuget.org/packages/XMLUnit.NUnit4.Constraints/)
18+
* [XMLUnit.Placeholders - simplifies comparisons for special cases ![nuget](https://img.shields.io/nuget/v/XMLUnit.Placeholders.svg)](https://www.nuget.org/packages/XMLUnit.Placeholders/)
19+
20+
[![Build status](https://ci.appveyor.com/api/projects/status/am34dfbr4vbcarr3?svg=true)]
21+
22+
## Requirements
23+
24+
XMLUnit requires .NET Standard 2.0 (tested with .NET 8 rigt now) and
25+
should still support .NET Framework 3.5 and Mono.
26+
27+
The core library hasn't got any dependencies itself.
28+
29+
## Usage
30+
31+
These are some really small examples, more is available as part of the
32+
[user guide](https://github.com/xmlunit/user-guide/wiki)
33+
34+
### Comparing Two Documents
35+
36+
```csharp
37+
ISource control = Input.FromFile("test-data/good.xml").Build();
38+
ISource test = Input.FromByteArray(CreateTestDocument()).Build();
39+
IDifferenceEngine diff = new DOMDifferenceEngine();
40+
diff.DifferenceListener += (comparison, outcome) => {
41+
Assert.Fail("found a difference: {}", comparison);
42+
};
43+
diff.Compare(control, test);
44+
```
45+
46+
or using the fluent builder API
47+
48+
```csharp
49+
Diff d = DiffBuilder.Compare(Input.FromFile("test-data/good.xml"))
50+
.WithTest(CreateTestDocument()).Build();
51+
Assert.IsFalse(d.HasDifferences());
52+
```
53+
54+
### Asserting an XPath Value
55+
56+
```csharp
57+
ISource source = Input.FromString("<foo>bar</foo>").Build();
58+
IXPathEngine xpath = new XPathEngine();
59+
IEnumerable<XmlNode> allMatches = xpath.SelectNodes("/foo", source);
60+
string content = xpath.evaluate("/foo/text()", source);
61+
```
62+
63+
### Validating a Document Against an XML Schema
64+
65+
66+
```csharp
67+
Validator v = Validator.ForLanguage(Languages.W3C_XML_SCHEMA_NS_URI);
68+
v.SchemaSources = new ISource[] {
69+
Input.FromUri("http://example.com/some.xsd").Build(),
70+
Input.FromFile("local.xsd").Build()
71+
};
72+
ValidationResult result = v.ValidateInstance(Input.FromDocument(CreateDocument()).Build());
73+
bool valid = result.Valid;
74+
IEnumerable<ValidationProblem> problems = result.Problems;
75+
```
76+
77+
## Additional Documentation
78+
79+
XMLUnit.NET is developed at
80+
[github](https://github.com/xmlunit/xmlunit.net). More documentation,
81+
releases and an issue tracker can be found there.
82+
83+
## Changelog
84+
85+
See the [Release
86+
Notes](https://github.com/xmlunit/xmlunit.net/blob/main/RELEASE_NOTES.md)
87+
at github.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# XMLUnit.NET
2+
3+
XMLUnit provides you with the tools to verify the XML you emit is the
4+
one you want to create.
5+
6+
This package provides a way to simplify comparisons by using a control
7+
document with a simple expression language to compare against.
8+
9+
## Requirements
10+
11+
XMLUnit requires .NET Standard 2.0 (tested with .NET 8 rigt now) and
12+
should still support .NET Framework 3.5 and Mono.
13+
14+
The placeholders package only depends on XMLUnit.Core.
15+
16+
## Usage
17+
18+
More documentaion is available as part of
19+
the [user guide](https://github.com/xmlunit/user-guide/wiki).
20+
21+
If you are creating documents with a structure like
22+
23+
```xml
24+
<message>
25+
<id>12345</id>
26+
<content>Hello</content>
27+
</message>
28+
```
29+
30+
and can't predict the `id` inside your tests but still want to assert
31+
it is a number, using just the core library will require some custom
32+
code as a `IDifferenceEvaluator`
33+
34+
Using the placeholders package you can write a control document like
35+
36+
```xml
37+
<message>
38+
<id>${xmlunit.isNumber}</id>
39+
<content>Hello</content>
40+
</message>
41+
```
42+
43+
and run the test like
44+
45+
```csharp
46+
string control = <the above>;
47+
string test = <the program output>;
48+
Diff diff = DiffBuilder.Compare(control).WithTest(test)
49+
.WithDifferenceEvaluator(new PlaceholderDifferenceEvaluator()).build();
50+
Assert.IsFalse(d.HasDifferences());
51+
```
52+
53+
Currently the fillowing placeholders are defined:
54+
55+
* `${xmlunit.ignore}` to completely ignore the element
56+
* `${xmlunit.isNumber}`
57+
* `${xmlunit.matchesRegex()}` with regex parameter
58+
* `${xmlunit.isDateTime()}` with optional format parameter
59+
60+
## Additional Documentation
61+
62+
XMLUnit.NET is developed at
63+
[github](https://github.com/xmlunit/xmlunit.net). More documentation,
64+
releases and an issue tracker can be found there.
65+
66+
## Changelog
67+
68+
See the [Release
69+
Notes](https://github.com/xmlunit/xmlunit.net/blob/main/RELEASE_NOTES.md)
70+
at github.

src/main/net-constraints-nunit2/XMLUnit.NUnit2.Constraints.nuspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
<frameworkAssembly assemblyName="System.Xml.Linq" />
2323
</frameworkAssemblies>
2424
<tags>xmlunit xml unit-testing test xmldiff nunit nunit2</tags>
25+
<readme>docs\README.md</readme>
2526
</metadata>
2627
<files>
2728
<file src="..\..\..\build/NetFramework/bin/Release/xmlunit-nunit2-constraints.dll" target="lib\net35"/>
2829
<file src="..\..\..\build/NetFramework/bin/Release/xmlunit-nunit2-constraints.pdb" target="lib\net35"/>
2930
<file src="..\..\..\build/NetFramework/bin/Release/xmlunit-nunit2-constraints.xml" target="lib\net35"/>
31+
<file src="..\..\doc/readmes/net-constraints-nunit2/README.md" target="docs"/>
3032
</files>
3133
</package>

src/main/net-constraints-nunit3/XMLUnit.NUnit3.Constraints.nuspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<frameworkAssembly assemblyName="System.Xml.Linq" />
2323
</frameworkAssemblies>
2424
<tags>xmlunit xml unit-testing test xmldiff nunit nunit3</tags>
25+
<readme>docs\README.md</readme>
2526
</metadata>
2627
<files>
2728
<file src="..\..\..\build/NetFramework/bin/Release/xmlunit-nunit3-constraints.dll" target="lib\net35"/>
@@ -30,5 +31,6 @@
3031
<file src="..\..\..\build/bin/Release/netstandard2.0/xmlunit-nunit3-constraints.dll" target="lib\netstandard2.0"/>
3132
<file src="..\..\..\build/bin/Release/netstandard2.0/xmlunit-nunit3-constraints.pdb" target="lib\netstandard2.0"/>
3233
<file src="..\..\..\build/bin/Release/netstandard2.0/xmlunit-nunit3-constraints.xml" target="lib\netstandard2.0"/>
34+
<file src="..\..\doc/readmes/net-constraints-nunit3/README.md" target="docs"/>
3335
</files>
3436
</package>

src/main/net-constraints-nunit4/XMLUnit.NUnit4.Constraints.nuspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<frameworkAssembly assemblyName="System.Xml.Linq" />
2323
</frameworkAssemblies>
2424
<tags>xmlunit xml unit-testing test xmldiff nunit nunit4</tags>
25+
<readme>docs\README.md</readme>
2526
</metadata>
2627
<files>
2728
<file src="..\..\..\build/NetFramework/bin/Release/xmlunit-nunit4-constraints.dll" target="lib\net462"/>
@@ -30,5 +31,6 @@
3031
<file src="..\..\..\build/bin/Release/net6.0/xmlunit-nunit4-constraints.dll" target="lib\net6.0"/>
3132
<file src="..\..\..\build/bin/Release/net6.0/xmlunit-nunit4-constraints.pdb" target="lib\net6.0"/>
3233
<file src="..\..\..\build/bin/Release/net6.0/xmlunit-nunit4-constraints.xml" target="lib\net6.0"/>
34+
<file src="..\..\doc/readmes/net-constraints-nunit4/README.md" target="docs"/>
3335
</files>
3436
</package>

0 commit comments

Comments
 (0)