Skip to content

Commit c4937f1

Browse files
refs pmengal#10 - vCalendar Date parse bug
1 parent be59cc3 commit c4937f1

6 files changed

Lines changed: 19 additions & 9 deletions

File tree

Class Library/ActiveUp.Net.Groupware/vCalendar/Parser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public static DateTime ParseDate(string input)
150150
input = input.Insert(4, "-");
151151
input = input.Insert(7, "-");
152152
}
153-
else if (input.Length == 16)
153+
else if (input.Length >= 15)
154154
{
155155
input = input.Insert(4, "-");
156156
input = input.Insert(7, "-");

Class Library/ActiveUp.Net.Tests/ActiveUp.Net.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
<AssemblyOriginatorKeyFile>ActiveUp.Net.snk</AssemblyOriginatorKeyFile>
6060
</PropertyGroup>
6161
<ItemGroup>
62-
<Reference Include="nunit.framework, Version=2.4.1.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
63-
<SpecificVersion>False</SpecificVersion>
64-
<HintPath>..\..\Libs\nunit.framework.dll</HintPath>
62+
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
63+
<HintPath>..\..\packages\NUnit.3.5.0\lib\net40\nunit.framework.dll</HintPath>
64+
<Private>True</Private>
6565
</Reference>
6666
<Reference Include="System" />
6767
<Reference Include="System.Core">

Class Library/ActiveUp.Net.Tests/Common/MimePartTests.cs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

Class Library/ActiveUp.Net.Tests/Common/RFC2047/Rfc2047DecoderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void should_handle_sample_headers()
143143
}
144144

145145
// This test is an example of how to do A/B testing for a header parser modification
146-
[Test, Ignore]
146+
[Test, Ignore("Manual test")]
147147
public void parser_evolution_example()
148148
{
149149
var allHeaders = File.ReadAllText("resource\\sample_headers.txt").Split(new[] { "\r\n\r\n\r\n" }, StringSplitOptions.RemoveEmptyEntries);
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
using ActiveUp.Net.Groupware.vCalendar;
22
using NUnit.Framework;
3+
using System;
34

45
namespace ActiveUp.Net.Tests.Groupware
56
{
67
[TestFixture]
78
public class ParserTests
89
{
910
[Test]
10-
public void should_parse_simple_date()
11+
public void should_parse_simple_file()
1112
{
1213
var vcal = Parser.Parse("TODO:");
1314

1415
Assert.AreEqual(0, vcal.Todos.Count);
1516
Assert.AreEqual(0, vcal.Events.Count);
1617
}
1718

19+
[Test]
20+
public void should_parse_simple_date()
21+
{
22+
var date = Parser.ParseDate("2016-11-21");
23+
Assert.AreEqual(new DateTime(2016, 11, 21, 00, 00, 00), date);
24+
var date2 = Parser.ParseDate("2016-11-21 15:30:25");
25+
Assert.AreEqual(new DateTime(2016,11,21,15,30,25), date2);
26+
}
27+
1828
}
1929
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="NUnit" version="3.2.0" targetFramework="net40" />
3+
<package id="NUnit" version="3.5.0" targetFramework="net40" />
44
</packages>

0 commit comments

Comments
 (0)