Skip to content

Commit 1aecdb7

Browse files
committed
[RELEASE] iText 9.2.0
2 parents 7470046 + 98ef798 commit 1aecdb7

File tree

1,555 files changed

+26601
-8042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,555 files changed

+26601
-8042
lines changed

Jenkinsfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ def solutionFile = "iTextCore.sln"
77
def frameworksToTest = "net461"
88
def frameworksToTestForMainBranches = "net461;netcoreapp2.0"
99

10-
automaticDotnetBuild(repoName, dependencyRegex, solutionFile, frameworksToTest, frameworksToTestForMainBranches)
10+
withEnv(
11+
['ITEXT_VERAPDFVALIDATOR_ENABLE_SERVER=true',
12+
'ITEXT_VERAPDFVALIDATOR_PORT=8091']) {
13+
automaticDotnetBuild(repoName, dependencyRegex, solutionFile, frameworksToTest, frameworksToTestForMainBranches)
14+
}

NOTICE.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This software uses third-party libraries under the licenses in the following files:
2+
- [styled-xml-parser/NOTICE.txt](itext/itext.styledxmlparser/NOTICE.txt)
3+
- [kernel/NOTICE.txt](itext/itext.kernel/NOTICE.txt)
4+
- [io/NOTICE.txt](itext/itext.io/NOTICE.txt)
5+
- [layout/NOTICE.txt](itext/itext.layout/NOTICE.txt)

README.md

+59-51
Large diffs are not rendered by default.

doxyfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "iText 9.1.0 API"
35+
PROJECT_NAME = "iText 9.2.0 API"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version

itext.nuspec

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
33
<metadata>
44
<id>itext</id>
5-
<version>9.1.0</version>
5+
<version>9.2.0</version>
66
<title>iText Community</title>
77
<authors>Apryse Software</authors>
88
<owners>Apryse Software</owners>
@@ -19,11 +19,11 @@
1919
<repository type="git" url="https://github.com/itext/itext7-dotnet.git" />
2020
<dependencies>
2121
<group targetFramework="net461">
22-
<dependency id="itext.commons" version="9.1.0" />
22+
<dependency id="itext.commons" version="9.2.0" />
2323
<dependency id="Microsoft.Extensions.Logging" version="5.0.0" />
2424
</group>
2525
<group targetFramework="netstandard2.0">
26-
<dependency id="itext.commons" version="9.1.0" />
26+
<dependency id="itext.commons" version="9.2.0" />
2727
<dependency id="Microsoft.Extensions.Logging" version="5.0.0" />
2828
<dependency id="System.Diagnostics.Process" version="4.3.0" />
2929
<dependency id="System.Globalization.Extensions" version="4.3.0" />
@@ -62,7 +62,7 @@
6262
<file src="itext\itext.styledxmlparser\bin\Release\net461\itext.styledxmlparser.xml" target="lib\net461" />
6363
<file src="itext\itext.svg\bin\Release\net461\itext.svg.dll" target="lib\net461" />
6464
<file src="itext\itext.svg\bin\Release\net461\itext.svg.xml" target="lib\net461" />
65-
<file src="itext\itext.bouncy-castle-connector\bin\Release\net461\itext.bouncy-castle-connector.dll" target="lib\net461" />
65+
<file src="itext\itext.bouncy-castle-connector\bin\Release\net461\itext.bouncy-castle-connector.dll" target="lib\net461" />
6666
<file src="itext\itext.bouncy-castle-connector\bin\Release\net461\itext.bouncy-castle-connector.xml" target="lib\net461" />
6767
<file src="itext\itext.io\bin\Release\netstandard2.0\itext.io.dll" target="lib\netstandard2.0" />
6868
<file src="itext\itext.io\bin\Release\netstandard2.0\itext.io.xml" target="lib\netstandard2.0" />
@@ -84,10 +84,14 @@
8484
<file src="itext\itext.styledxmlparser\bin\Release\netstandard2.0\itext.styledxmlparser.xml" target="lib\netstandard2.0" />
8585
<file src="itext\itext.svg\bin\Release\netstandard2.0\itext.svg.dll" target="lib\netstandard2.0" />
8686
<file src="itext\itext.svg\bin\Release\netstandard2.0\itext.svg.xml" target="lib\netstandard2.0" />
87-
<file src="itext\itext.bouncy-castle-connector\bin\Release\netstandard2.0\itext.bouncy-castle-connector.dll" target="lib\netstandard2.0" />
87+
<file src="itext\itext.bouncy-castle-connector\bin\Release\netstandard2.0\itext.bouncy-castle-connector.dll" target="lib\netstandard2.0" />
8888
<file src="itext\itext.bouncy-castle-connector\bin\Release\netstandard2.0\itext.bouncy-castle-connector.xml" target="lib\netstandard2.0" />
8989
<file src="gnu-agpl-v3.0.md" target="" />
9090
<file src="LICENSE.md" target="" />
91-
<file src="ITSC-avatar.png" target="" />
91+
<file src="ITSC-avatar.png" target="" />
92+
<file src="itext\itext.kernel\NOTICE.txt" target="NOTICE_kernel.txt" />
93+
<file src="itext\itext.layout\NOTICE.txt" target="NOTICE_layout.txt" />
94+
<file src="itext\itext.styledxmlparser\NOTICE.txt" target="NOTICE_styledxmlparser.txt" />
95+
<file src="itext\itext.io\NOTICE.txt" target="NOTICE_io.txt" />
9296
</files>
9397
</package>

itext.tests/itext.barcodes.tests/Properties/AssemblyInfo.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using NUnit.Framework;
12
using System.Reflection;
23
using System.Runtime.InteropServices;
34

@@ -14,9 +15,11 @@
1415

1516
[assembly: Guid("d015a3aa-613c-45d9-b908-7d47c4b613af")]
1617

17-
[assembly: AssemblyVersion("9.1.0.0")]
18-
[assembly: AssemblyFileVersion("9.1.0.0")]
19-
[assembly: AssemblyInformationalVersion("9.1.0")]
18+
[assembly: AssemblyVersion("9.2.0.0")]
19+
[assembly: AssemblyFileVersion("9.2.0.0")]
20+
[assembly: AssemblyInformationalVersion("9.2.0")]
21+
22+
[assembly: Parallelizable(ParallelScope.ContextMask)]
2023

2124
#if !NETSTANDARD2_0
2225
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.barcodes.tests/itext.barcodes.tests.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
</PropertyGroup>
2828
<PropertyGroup>
2929
<NoWarn>1701;1702;1591;1570;1572;1573;1574;1580;1584;1658</NoWarn>
30+
<!-- TODO DEVSIX-9075: remove this suppression -->
31+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
3032
</PropertyGroup>
3133
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
3234
<Reference Include="System" />

itext.tests/itext.barcodes.tests/itext/barcodes/Barcode128Test.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public class Barcode128Test : ExtendedITextTest {
3333
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3434
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3535

36-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
37-
+ "/test/itext/barcodes/Barcode128/";
36+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/Barcode128/";
3837

3938
[NUnit.Framework.OneTimeSetUp]
4039
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/Barcode39Test.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class Barcode39Test : ExtendedITextTest {
3434
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3535
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3636

37-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
38-
+ "/test/itext/barcodes/Barcode39/";
37+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/Barcode39/";
3938

4039
[NUnit.Framework.OneTimeSetUp]
4140
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeCodabarTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class BarcodeCodabarTest : ExtendedITextTest {
3434
private static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3535
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3636

37-
private static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory
38-
+ "/test/itext/barcodes/Codabar/";
37+
private static readonly String DESTINATION_FOLDER = TestUtil.GetOutputPath() + "/barcodes/Codabar/";
3938

4039
[NUnit.Framework.OneTimeSetUp]
4140
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeDataMatrixTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ You should have received a copy of the GNU Affero General Public License
3030
namespace iText.Barcodes {
3131
[NUnit.Framework.Category("IntegrationTest")]
3232
public class BarcodeDataMatrixTest : ExtendedITextTest {
33-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
34-
+ "/test/itext/barcodes/BarcodeDataMatrix/";
33+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/BarcodeDataMatrix/";
3534

3635
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3736
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeEANTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public class BarcodeEANTest : ExtendedITextTest {
3333
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3434
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3535

36-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
37-
+ "/test/itext/barcodes/BarcodeEAN/";
36+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/BarcodeEAN/";
3837

3938
[NUnit.Framework.OneTimeSetUp]
4039
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeInter25Test.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public class BarcodeInter25Test : ExtendedITextTest {
3333
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3434
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3535

36-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
37-
+ "/test/itext/barcodes/BarcodeInter25/";
36+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/BarcodeInter25/";
3837

3938
[NUnit.Framework.OneTimeSetUp]
4039
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeMSITest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class BarcodeMSITest : ExtendedITextTest {
3434
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3535
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3636

37-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
38-
+ "/test/itext/barcodes/BarcodeMSI/";
37+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/BarcodeMSI/";
3938

4039
[NUnit.Framework.OneTimeSetUp]
4140
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodePDF417Test.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ public class BarcodePDF417Test : ExtendedITextTest {
3939
private static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
4040
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
4141

42-
private static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory
43-
+ "/test/itext/barcodes/BarcodePDF417/";
42+
private static readonly String DESTINATION_FOLDER = TestUtil.GetOutputPath() + "/barcodes/BarcodePDF417/";
4443

4544
[NUnit.Framework.OneTimeSetUp]
4645
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodePostnetTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public class BarcodePostnetTest : ExtendedITextTest {
3232
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3333
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3434

35-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
36-
+ "/test/itext/barcodes/BarcodePostnet/";
35+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/BarcodePostnet/";
3736

3837
[NUnit.Framework.OneTimeSetUp]
3938
public static void BeforeClass() {

itext.tests/itext.barcodes.tests/itext/barcodes/BarcodeQRCodeTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public class BarcodeQRCodeTest : ExtendedITextTest {
3535
public static readonly String sourceFolder = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext
3636
.CurrentContext.TestDirectory) + "/resources/itext/barcodes/";
3737

38-
public static readonly String destinationFolder = NUnit.Framework.TestContext.CurrentContext.TestDirectory
39-
+ "/test/itext/barcodes/BarcodeQRCode/";
38+
public static readonly String destinationFolder = TestUtil.GetOutputPath() + "/barcodes/BarcodeQRCode/";
4039

4140
[NUnit.Framework.OneTimeSetUp]
4241
public static void BeforeClass() {

itext.tests/itext.commons.tests/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
[assembly: Guid("502eda37-c014-4822-8e5c-4e5d21b085e9")]
1717

18-
[assembly: AssemblyVersion("9.1.0.0")]
19-
[assembly: AssemblyFileVersion("9.1.0.0")]
20-
[assembly: AssemblyInformationalVersion("9.1.0")]
18+
[assembly: AssemblyVersion("9.2.0.0")]
19+
[assembly: AssemblyFileVersion("9.2.0.0")]
20+
[assembly: AssemblyInformationalVersion("9.2.0")]
2121

2222
#if !NETSTANDARD2_0
2323
[assembly: NUnit.Framework.Timeout(300000)]

itext.tests/itext.commons.tests/itext.commons.tests.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<SignAssembly>True</SignAssembly>
44
<DelaySign>False</DelaySign>
55
<WarningLevel>0</WarningLevel>
6+
<LangVersion>9.0</LangVersion>
67
</PropertyGroup>
78
<PropertyGroup>
89
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
@@ -27,6 +28,8 @@
2728
</PropertyGroup>
2829
<PropertyGroup>
2930
<NoWarn>1701;1702;1591;1570;1572;1573;1574;1580;1584;1658</NoWarn>
31+
<!-- TODO DEVSIX-9075: remove this suppression -->
32+
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
3033
</PropertyGroup>
3134
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
3235
<Reference Include="System" />

itext.tests/itext.commons.tests/itext/commons/actions/contexts/ContextManagerTest.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace iText.Commons.Actions.Contexts {
3131
public class ContextManagerTest : ExtendedITextTest {
3232
[NUnit.Framework.Test]
3333
public virtual void GetRecognisedNamespaceForSpecificNamespaceTest() {
34-
String outerNamespaces = NamespaceConstant.ITEXT.ToLowerInvariant();
35-
String innerNamespaces = NamespaceConstant.PDF_HTML.ToLowerInvariant();
34+
String outerNamespaces = StringNormalizer.ToLowerCase(NamespaceConstant.ITEXT);
35+
String innerNamespaces = StringNormalizer.ToLowerCase(NamespaceConstant.PDF_HTML);
3636
NUnit.Framework.Assert.IsTrue(innerNamespaces.StartsWith(outerNamespaces));
3737
ContextManager managerOuterBeforeInner = new ContextManager();
3838
managerOuterBeforeInner.RegisterGenericContext(JavaCollectionsUtil.SingletonList(outerNamespaces), JavaCollectionsUtil
@@ -68,9 +68,9 @@ public virtual void UnregisterNamespaceTest() {
6868
ContextManager manager = new ContextManager();
6969
NUnit.Framework.Assert.IsNull(manager.GetRecognisedNamespace(testNamespace));
7070
NUnit.Framework.Assert.IsNull(manager.GetRecognisedNamespace(testNamespaceWithCapitals));
71-
manager.RegisterGenericContext(testNamespaces, JavaUtil.ArraysAsList("myProduct"));
71+
manager.RegisterGenericContext(testNamespaces, JavaCollectionsUtil.SingletonList("myProduct"));
7272
NUnit.Framework.Assert.AreEqual(testNamespace, manager.GetRecognisedNamespace(testNamespace + ".MyClass"));
73-
NUnit.Framework.Assert.AreEqual(testNamespaceWithCapitals.ToLowerInvariant(), manager.GetRecognisedNamespace
73+
NUnit.Framework.Assert.AreEqual(StringNormalizer.ToLowerCase(testNamespaceWithCapitals), manager.GetRecognisedNamespace
7474
(testNamespaceWithCapitals + ".MyClass"));
7575
manager.UnregisterContext(testNamespaces);
7676
NUnit.Framework.Assert.IsNull(manager.GetRecognisedNamespace(testNamespace));
@@ -80,8 +80,8 @@ public virtual void UnregisterNamespaceTest() {
8080
[NUnit.Framework.Test]
8181
public virtual void RegisteredNamespaceTest() {
8282
String registeredNamespace = NamespaceConstant.CORE_LAYOUT + "custompackage";
83-
NUnit.Framework.Assert.AreEqual(NamespaceConstant.CORE_LAYOUT.ToLowerInvariant(), ContextManager.GetInstance
84-
().GetRecognisedNamespace(registeredNamespace));
83+
NUnit.Framework.Assert.AreEqual(StringNormalizer.ToLowerCase(NamespaceConstant.CORE_LAYOUT), ContextManager
84+
.GetInstance().GetRecognisedNamespace(registeredNamespace));
8585
}
8686
}
8787
}

itext.tests/itext.commons.tests/itext/commons/actions/producer/ProducerBuilderTest.cs

+23
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,29 @@ public virtual void OldProducerEqualsCurrentProducerTest() {
197197
NUnit.Framework.Assert.AreEqual("some Author", newProducerLine);
198198
}
199199

200+
[NUnit.Framework.Test]
201+
public virtual void MergeEquivalentProducersTest() {
202+
String producerLine = "some producer";
203+
String result = ProducerBuilder.MergeProducerLines(producerLine, producerLine);
204+
NUnit.Framework.Assert.AreEqual(producerLine, result);
205+
}
206+
207+
[NUnit.Framework.Test]
208+
public virtual void MergeDifferentProducersTest() {
209+
String producerLine = "some producer";
210+
String secondProducerLine = "another producer";
211+
String result = ProducerBuilder.MergeProducerLines(producerLine, secondProducerLine);
212+
NUnit.Framework.Assert.AreEqual(producerLine + "; modified using " + secondProducerLine, result);
213+
}
214+
215+
[NUnit.Framework.Test]
216+
public virtual void MergeProducerEndsWithSecondProducerTest() {
217+
String producerLine = "some producer; modified using another producer";
218+
String secondProducerLine = "another producer";
219+
String result = ProducerBuilder.MergeProducerLines(producerLine, secondProducerLine);
220+
NUnit.Framework.Assert.AreEqual(producerLine, result);
221+
}
222+
200223
private IList<ConfirmedEventWrapper> GetEvents(String initialProducerLine, params int[] indexes) {
201224
IList<ConfirmedEventWrapper> events = new List<ConfirmedEventWrapper>();
202225
for (int ind = 0; ind < indexes.Length; ind++) {

itext.tests/itext.commons.tests/itext/commons/actions/producer/UsedProductsPlaceholderPopulatorTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public virtual void HumanReadableNormalizationTest() {
121121
ProductData productData = new ProductData("public-name", "name", "1.0.0", 2020, 2021);
122122
ConfirmedEventWrapper @event = new ConfirmedEventWrapper(new ITextTestEvent(new SequenceId(), productData,
123123
null, "testing"), "nonproduction", "iText product");
124-
String result = populator.Populate(JavaUtil.ArraysAsList(@event), "'module:'P #V (T)");
124+
String result = populator.Populate(JavaCollectionsUtil.SingletonList(@event), "'module:'P #V (T)");
125125
NUnit.Framework.Assert.AreEqual("module:public-name #1.0.0 (non-production)", result);
126126
}
127127

itext.tests/itext.commons.tests/itext/commons/datastructures/Tuple2Test.cs

+44
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,49 @@ public virtual void TestTuple2_TestWithNullFirstValue() {
4545
NUnit.Framework.Assert.IsNull(tuple.GetFirst());
4646
NUnit.Framework.Assert.AreEqual(Convert.ToInt32(1), tuple.GetSecond());
4747
}
48+
49+
[NUnit.Framework.Test]
50+
public virtual void EqualsTest() {
51+
Tuple2<String, int> tuple1 = new Tuple2<String, int>("test", 1);
52+
Tuple2<String, int> tuple2 = new Tuple2<String, int>("test", 1);
53+
NUnit.Framework.Assert.AreEqual(tuple1, tuple2);
54+
}
55+
56+
[NUnit.Framework.Test]
57+
public virtual void EqualsSameTest() {
58+
Tuple2<String, int> tuple = new Tuple2<String, int>("test", 1);
59+
NUnit.Framework.Assert.AreEqual(tuple, tuple);
60+
}
61+
62+
[NUnit.Framework.Test]
63+
public virtual void EqualsNullTest() {
64+
Tuple2<String, int> tuple = new Tuple2<String, int>("test", 1);
65+
NUnit.Framework.Assert.AreNotEqual(tuple, null);
66+
}
67+
68+
[NUnit.Framework.Test]
69+
public virtual void NotEqualsTest() {
70+
Tuple2<String, int> tuple1 = new Tuple2<String, int>("test", 1);
71+
Tuple2<String, int> tuple2 = new Tuple2<String, int>("test", 2);
72+
Tuple2<String, int> tuple3 = new Tuple2<String, int>("test2", 2);
73+
NUnit.Framework.Assert.AreNotEqual(tuple1, tuple2);
74+
NUnit.Framework.Assert.AreNotEqual(tuple2, tuple3);
75+
NUnit.Framework.Assert.AreNotEqual(tuple1, tuple3);
76+
}
77+
78+
[NUnit.Framework.Test]
79+
public virtual void EqualsWithCustomTest() {
80+
Tuple2<String, int> tuple1 = new Tuple2<String, int>("test", 1);
81+
Tuple2<String, int> tuple2 = new Tuple2Test.CustomTuple2<String, int>("test", 1);
82+
Tuple2<String, int> tuple3 = new Tuple2Test.CustomTuple2<String, int>("test", 1);
83+
NUnit.Framework.Assert.AreNotEqual(tuple1, tuple2);
84+
NUnit.Framework.Assert.AreEqual(tuple2, tuple3);
85+
}
86+
87+
private class CustomTuple2<T1, T2> : Tuple2<T1, T2> {
88+
public CustomTuple2(T1 test, T2 i)
89+
: base(test, i) {
90+
}
91+
}
4892
}
4993
}

0 commit comments

Comments
 (0)