Skip to content

Commit

Permalink
Fixed NEWNEWS wildmat bug. Fixed HeaderDateParser tests. Updated pack…
Browse files Browse the repository at this point in the history
…ages. (#10)
  • Loading branch information
keimpema authored Oct 26, 2019
1 parent fe6ae0f commit a68dedd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Usenet/Nntp/NntpClient.rfc3977.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public NntpGroupsResponse NewGroups(NntpDateTime sinceDateTime) =>
/// posted or received since this date and time.</param>
/// <returns>A multi-line response containing a list of message-ids.</returns>
public NntpMultiLineResponse NewNews(string wildmat, NntpDateTime sinceDateTime) =>
connection.MultiLineCommand($"NEWNEWS {sinceDateTime}", new MultiLineResponseParser(230));
connection.MultiLineCommand($"NEWNEWS {wildmat} {sinceDateTime}", new MultiLineResponseParser(230));


/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions Usenet/Usenet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersionTask" Version="4.0.0">
<PackageReference Include="GitVersionTask" Version="5.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="LibLog" Version="5.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="2.2.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Abstractions" Version="3.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="1.6.0" />
<PackageReference Include="System.Net.Security" Version="4.3.2" />
</ItemGroup>

Expand Down
7 changes: 4 additions & 3 deletions UsenetTests/Nntp/Parsers/HeaderDateParserTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using Usenet.Nntp.Parsers;
using Xunit;

Expand Down Expand Up @@ -53,7 +54,7 @@ public void ObsoleteTwoDigitYearBeforeCurrentDateShouldBeParsedCorrectly()
{
DateTimeOffset yesterday = new DateTimeOffset(DateTime.UtcNow.Date.AddDays(-1), TimeSpan.Zero);
DateTimeOffset expectedDate = yesterday;
string headerValue = $"{yesterday:dd MMM yy HH:mm:ss} +0000";
string headerValue = yesterday.ToString("dd MMM yy HH:mm:ss", CultureInfo.InvariantCulture) + " +0000";
DateTimeOffset actualDate = HeaderDateParser.Parse(headerValue).GetValueOrDefault();
Assert.Equal(expectedDate, actualDate);
}
Expand All @@ -63,7 +64,7 @@ public void ObsoleteTwoDigitYearAfterCurrentDateShouldBeParsedCorrectly()
{
DateTimeOffset tomorrow = new DateTimeOffset(DateTime.UtcNow.Date.AddDays(+1), TimeSpan.Zero);
DateTimeOffset expectedDate = tomorrow.AddYears(-100);
string headerValue = $"{tomorrow:dd MMM yy HH:mm:ss} +0000";
string headerValue = tomorrow.ToString("dd MMM yy HH:mm:ss", CultureInfo.InvariantCulture) + " +0000";
DateTimeOffset actualDate = HeaderDateParser.Parse(headerValue).GetValueOrDefault();
Assert.Equal(expectedDate, actualDate);
}
Expand All @@ -73,7 +74,7 @@ public void ObsoleteTwoDigitYearOnCurrentDateShouldBeParsedCorrectly()
{
var today = new DateTimeOffset(DateTime.UtcNow.Date, TimeSpan.Zero);
DateTimeOffset expectedDate = today;
string headerValue = $"{expectedDate:dd MMM yy HH:mm:ss} +0000";
string headerValue = expectedDate.ToString("dd MMM yy HH:mm:ss", CultureInfo.InvariantCulture) + " +0000";
DateTimeOffset actualDate = HeaderDateParser.Parse(headerValue).GetValueOrDefault();
Assert.Equal(expectedDate, actualDate);
}
Expand Down
6 changes: 3 additions & 3 deletions UsenetTests/UsenetTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="Moq" Version="4.10.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit a68dedd

Please sign in to comment.