Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Use Trace.WriteLine instead of Console.WriteLine
Browse files Browse the repository at this point in the history
  • Loading branch information
tparviainen committed Jun 29, 2019
1 parent 0f5961a commit 6f3bd65
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
21 changes: 11 additions & 10 deletions src/ClashOfClans.Tests/ClansTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ClashOfClans.Search;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;

Expand Down Expand Up @@ -51,13 +52,13 @@ public async Task LoopClansFromSpecificLocation(string locationName)
do
{
var searchResult = await _coc.Clans.GetAsync(query);
searchResult.Items.ToList().ForEach(clan => Console.WriteLine(clan));
searchResult.Items.ToList().ForEach(clan => Trace.WriteLine(clan));
query.After = searchResult.Paging.Cursors.After;
count += searchResult.Items.Count();
} while (query.After != null);

// Assert
Console.WriteLine($"{locationName}: {count}");
Trace.WriteLine($"{locationName}: {count}");
Assert.IsTrue(count != 0);
}

Expand All @@ -69,7 +70,7 @@ public async Task GetClanInformation()

// Act
var clan = await _coc.Clans.GetAsync(clanTag);
Console.WriteLine(clan);
Trace.WriteLine(clan);

// Assert
Assert.IsNotNull(clan);
Expand Down Expand Up @@ -97,10 +98,10 @@ public async Task RetrieveClansClanWarLog()
// Act
if (clan != null)
{
Console.WriteLine(clan);
Trace.WriteLine(clan);

var clanWarLog = await _coc.Clans.GetWarLogAsync(clan.Tag);
Console.WriteLine(clanWarLog);
Trace.WriteLine(clanWarLog);

// Assert
Assert.IsNotNull(clanWarLog);
Expand All @@ -120,10 +121,10 @@ public async Task RetrieveInformationAboutClansCurrentClanWar()
// Act
if (clan != null)
{
Console.WriteLine(clan);
Trace.WriteLine(clan);

var currentWar = await _coc.Clans.GetCurrentWarAsync(clan.Tag);
Console.WriteLine(currentWar);
Trace.WriteLine(currentWar);

// Assert
Assert.IsNotNull(currentWar);
Expand All @@ -138,12 +139,12 @@ public async Task RetrieveInformationAboutClansCurrentClanWarLeagueGroupAndWar()
// Act
foreach (var clan in _clans.Items)
{
Console.WriteLine(clan);
Trace.WriteLine(clan);

try
{
var leaguegroup = await _coc.Clans.GetCurrentWarLeagueGroupAsync(clan.Tag);
Console.WriteLine(leaguegroup);
Trace.WriteLine(leaguegroup);

// WarTag="#0" round not started
var round = GetRandom(leaguegroup.Rounds, r => !r.WarTags.Contains("#0"));
Expand All @@ -157,7 +158,7 @@ public async Task RetrieveInformationAboutClansCurrentClanWarLeagueGroupAndWar()
}
catch (ClashOfClansException ex)
{
Console.WriteLine(ex.Error);
Trace.WriteLine(ex.Error);
}
}
}
Expand Down
27 changes: 14 additions & 13 deletions src/ClashOfClans.Tests/ValidatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using ClashOfClans.Validation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;

namespace ClashOfClans.Tests
{
Expand All @@ -24,7 +25,7 @@ public void ClanTagMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -44,7 +45,7 @@ public void ClanTagsStartWithHashCharacter()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -64,7 +65,7 @@ public void LeagueIdentifierMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -84,7 +85,7 @@ public void LocationIdentifierMustNotNeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -104,7 +105,7 @@ public void PlayerTagMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -124,7 +125,7 @@ public void PlayerTagsStartWithHashCharacter()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -144,7 +145,7 @@ public void QueryMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -168,7 +169,7 @@ public void NameNeedsToBeAtLeastThreeCharactersLong()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -193,7 +194,7 @@ public void OnlyAfterOrBeforeCanBeSpecifiedForAQueryNotBoth()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -213,7 +214,7 @@ public void SeasonIdentifierMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -233,7 +234,7 @@ public void TokenMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -253,7 +254,7 @@ public void WarTagMustNotBeEmpty()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}

Expand All @@ -273,7 +274,7 @@ public void WarTagIsNotValid()
}
catch (ArgumentException ex)
{
Console.WriteLine(ex);
Trace.WriteLine(ex);
}
}
}
Expand Down

0 comments on commit 6f3bd65

Please sign in to comment.