Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TUnit.Core/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public virtual string GetStandardOutput()

try
{
return _outputBuilder.ToString().Trim();
return _outputBuilder.ToString();
}
finally
{
Expand All @@ -98,7 +98,7 @@ public virtual string GetErrorOutput()

try
{
return _errorOutputBuilder.ToString().Trim();
return _errorOutputBuilder.ToString();
}
finally
{
Expand Down
10 changes: 5 additions & 5 deletions TUnit.TestProject/CaptureOutputTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task Test()
using (Assert.Multiple())
{
await Assert.That(TestContext.Current!.Metadata.TestDetails.TestName).IsEqualTo("Test");
await Assert.That(TestContext.Current.GetStandardOutput()).IsEqualTo("Blah1");
await Assert.That(TestContext.Current.GetStandardOutput()).Contains("Blah1");
}
}

Expand All @@ -25,7 +25,7 @@ public async Task Test2()
using (Assert.Multiple())
{
await Assert.That(TestContext.Current!.Metadata.TestDetails.TestName).IsEqualTo("Test2");
await Assert.That(TestContext.Current.GetStandardOutput()).IsEqualTo("Blah2");
await Assert.That(TestContext.Current.GetStandardOutput()).Contains("Blah2");
}
}

Expand All @@ -37,7 +37,7 @@ public async Task Test3()
using (Assert.Multiple())
{
await Assert.That(TestContext.Current!.Metadata.TestDetails.TestName).IsEqualTo("Test3");
await Assert.That(TestContext.Current.GetStandardOutput()).IsEqualTo("Blah3");
await Assert.That(TestContext.Current.GetStandardOutput()).Contains("Blah3");
}
}

Expand All @@ -49,7 +49,7 @@ public async Task Test4()
using (Assert.Multiple())
{
await Assert.That(TestContext.Current!.Metadata.TestDetails.TestName).IsEqualTo("Test4");
await Assert.That(TestContext.Current.GetStandardOutput()).IsEqualTo("Blah4");
await Assert.That(TestContext.Current.GetStandardOutput()).Contains("Blah4");
}
}

Expand All @@ -61,7 +61,7 @@ public async Task Test5()
using (Assert.Multiple())
{
await Assert.That(TestContext.Current!.Metadata.TestDetails.TestName).IsEqualTo("Test5");
await Assert.That(TestContext.Current.GetStandardOutput()).IsEqualTo("Blah5");
await Assert.That(TestContext.Current.GetStandardOutput()).Contains("Blah5");
}
}

Expand Down
2 changes: 1 addition & 1 deletion TUnit.TestProject/ConsoleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class ConsoleTests
public async Task Write_Source_Gen_Information()
{
Console.WriteLine(TestContext.Current!.Metadata.TestDetails.MethodMetadata);
await Assert.That(TestContext.Current.GetStandardOutput()).IsEqualTo(TestContext.Current.Metadata.TestDetails.MethodMetadata.ToString());
await Assert.That(TestContext.Current.GetStandardOutput()).Contains(TestContext.Current.Metadata.TestDetails.MethodMetadata.ToString()!);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Test Body
Tests.B_After3
Tests.Y_After3
Tests.Z_After3

""");
}
}
1 change: 1 addition & 0 deletions TUnit.TestProject/OrderedSetupTests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Test Body
Tests.Y_After3
Tests.A_After3
Tests.B_After3

""");
}
}
2 changes: 1 addition & 1 deletion TUnit.TestProject/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
Console.WriteLine(@"Blah!");

await Assert.That(TestContext.Current?.GetStandardOutput()).IsEqualTo("Blah!", StringComparison.Ordinal);
await Assert.That(TestContext.Current?.GetStandardOutput()).Contains("Blah!");
}

[Test]
Expand Down Expand Up @@ -64,7 +64,7 @@
[Category("Fail")]
public async Task ParameterisedTests1(string value)
{
await Assert.That(value).IsEqualTo("1").And.HasLength().EqualTo(1);

Check warning on line 67 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

'AssertionExtensions.HasLength(IAssertionSource<string>)' is obsolete: 'Use Length() instead, which provides all numeric assertion methods. Example: Assert.That(str).Length().IsGreaterThan(5)'

Check warning on line 67 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (windows-latest)

'AssertionExtensions.HasLength(IAssertionSource<string>)' is obsolete: 'Use Length() instead, which provides all numeric assertion methods. Example: Assert.That(str).Length().IsGreaterThan(5)'
}

[Test]
Expand Down Expand Up @@ -242,14 +242,14 @@
[Category("Pass")]
public async Task String_And_Condition()
{
await Assert.That("1").IsEqualTo("1").And.HasLength().EqualTo(1);

Check warning on line 245 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

'AssertionExtensions.HasLength(IAssertionSource<string>)' is obsolete: 'Use Length() instead, which provides all numeric assertion methods. Example: Assert.That(str).Length().IsGreaterThan(5)'

Check warning on line 245 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (windows-latest)

'AssertionExtensions.HasLength(IAssertionSource<string>)' is obsolete: 'Use Length() instead, which provides all numeric assertion methods. Example: Assert.That(str).Length().IsGreaterThan(5)'
}

[Test]
[Category("Fail")]
public async Task String_And_Condition2()
{
await Assert.That("1").IsEqualTo("2").And.HasLength().EqualTo(2);

Check warning on line 252 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

'AssertionExtensions.HasLength(IAssertionSource<string>)' is obsolete: 'Use Length() instead, which provides all numeric assertion methods. Example: Assert.That(str).Length().IsGreaterThan(5)'

Check warning on line 252 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (windows-latest)

'AssertionExtensions.HasLength(IAssertionSource<string>)' is obsolete: 'Use Length() instead, which provides all numeric assertion methods. Example: Assert.That(str).Length().IsGreaterThan(5)'
}

[Test]
Expand All @@ -257,7 +257,7 @@
public async Task Count1()
{
var list = new List<int> { 1, 2, 3 };
await Assert.That(list).IsEquivalentTo([1, 2, 3]).And.HasCount().EqualTo(3);

Check warning on line 260 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

'CollectionAssertionBase<IEnumerable<int>, int>.HasCount()' is obsolete: 'Use Count() instead, which provides all numeric assertion methods. Example: Assert.That(list).Count().IsGreaterThan(5)'

Check warning on line 260 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (windows-latest)

'CollectionAssertionBase<IEnumerable<int>, int>.HasCount()' is obsolete: 'Use Count() instead, which provides all numeric assertion methods. Example: Assert.That(list).Count().IsGreaterThan(5)'
}

[Test]
Expand Down Expand Up @@ -290,7 +290,7 @@
public async Task Count2()
{
var list = new List<int> { 1, 2, 3 };
await Assert.That(list).IsEquivalentTo([1, 2, 3, 4, 5]).And.HasCount().EqualTo(5);

Check warning on line 293 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

'CollectionAssertionBase<IEnumerable<int>, int>.HasCount()' is obsolete: 'Use Count() instead, which provides all numeric assertion methods. Example: Assert.That(list).Count().IsGreaterThan(5)'

Check warning on line 293 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (windows-latest)

'CollectionAssertionBase<IEnumerable<int>, int>.HasCount()' is obsolete: 'Use Count() instead, which provides all numeric assertion methods. Example: Assert.That(list).Count().IsGreaterThan(5)'
}

[Test]
Expand All @@ -301,7 +301,7 @@
using (Assert.Multiple())
{
await Assert.That(list).IsEquivalentTo([1, 2, 3, 4, 5]);
await Assert.That(list).HasCount().EqualTo(5);

Check warning on line 304 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (ubuntu-latest)

'CollectionAssertionBase<IEnumerable<int>, int>.HasCount()' is obsolete: 'Use Count() instead, which provides all numeric assertion methods. Example: Assert.That(list).Count().IsGreaterThan(5)'

Check warning on line 304 in TUnit.TestProject/Tests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (windows-latest)

'CollectionAssertionBase<IEnumerable<int>, int>.HasCount()' is obsolete: 'Use Count() instead, which provides all numeric assertion methods. Example: Assert.That(list).Count().IsGreaterThan(5)'
}
}

Expand Down
Loading