Skip to content

Commit

Permalink
.NET8 for SIL.Lift.Tests (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmyers authored Oct 25, 2024
1 parent db2f2ba commit b896e28
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 448 deletions.
23 changes: 9 additions & 14 deletions SIL.Lift.Tests/Parsing/ExtensibleMatcher.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.IO;
using NMock2;
using SIL.Lift.Parsing;

namespace SIL.Lift.Tests.Parsing
{
class ExtensibleMatcher:Matcher
class ExtensibleMatcher : Extensible
{
private readonly string _expectedId;
private readonly Guid _expectedGuid;
Expand Down Expand Up @@ -45,8 +43,14 @@ public ExtensibleMatcher()
: this(string.Empty)
{
}
public override bool Matches(object o)

public override bool Equals(object o)
{
if (o == null)
{
throw new NullReferenceException();
}

Extensible e = (Extensible) o;

if (e.Id != _expectedId)
Expand All @@ -73,14 +77,5 @@ public override bool Matches(object o)
}
return true;
}

public override void DescribeTo(TextWriter writer)
{
writer.Write(string.Format("ExtensibleMatcher(expectedId={0}, expectedGuid={1}, expectedCreationTime={2}, expectedModificationTime={3})",
_expectedId,
(_expectedGuid==Guid.Empty)?"anything": _expectedGuid.ToString(),
(_expectedCreationTime == DateTime.MinValue) ? "anything" : _expectedCreationTime.ToString(),
(_expectedModificationTime == DateTime.MinValue) ? "anything" : _expectedModificationTime.ToString()));
}
}
}
}
16 changes: 7 additions & 9 deletions SIL.Lift.Tests/Parsing/LiftMultiTextAnnotationMatcher.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.IO;
using NMock2;
using SIL.Lift.Parsing;

namespace SIL.Lift.Tests.Parsing
{
class LiftMultiTextAnnotationMatcher : Matcher
class LiftMultiTextAnnotationMatcher : LiftMultiText
{
private readonly string _expectedLanguageOfFirstAnnotation;
private readonly string _expectedNameOfFirstAnnotation;
Expand All @@ -24,8 +22,13 @@ public LiftMultiTextAnnotationMatcher(int expectedNumberOfAnnotations, string ex
_expectedNameOfFirstAnnotation = expectedNameOfFirstAnnotation;
}

public override bool Matches(object o)
public override bool Equals(object o)
{
if (o == null)
{
throw new NullReferenceException();
}

LiftMultiText m = (LiftMultiText)o;
if (m.Annotations.Count != _expectedCount)
{
Expand All @@ -44,10 +47,5 @@ public override bool Matches(object o)
&& t.Who == _expectedWhoOfFirstAnnotation
&& t.When == _expectedWhenOfFirstAnnotation);
}

public override void DescribeTo(TextWriter writer)
{
writer.Write(string.Format("LiftMultiTextAnnotationMatcher(expectedName={1}, expectedValue={2}, numberOfAnnotations={3})", _expectedLanguageOfFirstAnnotation, _expectedNameOfFirstAnnotation, _expectedValueOfFirstAnnotation, _expectedCount));
}
}
}
Loading

0 comments on commit b896e28

Please sign in to comment.