Permalink
Browse files

Add Ascii85HttpHeader files.

  • Loading branch information...
1 parent bdd013c commit 929f53d71817106ebc25ae5633913b9037b59f2f @bgrainger bgrainger committed Feb 24, 2013
View
@@ -8,10 +8,12 @@
# grandfather in existing files so their line endings don't get spuriously changed
ReadMe.txt -text eol=crlf
src/Logos.Utility/Ascii85.cs -text eol=crlf
+src/Logos.Utility/Ascii85HttpHeader.cs -text eol=crlf
src/Logos.Utility/GenericComparer.cs -text eol=crlf
src/Logos.Utility/GuidUtility.cs -text eol=crlf
src/Logos.Utility/Net/WebExceptionUtility.cs -text eol=crlf
src/Logos.Utility/Properties/AssemblyInfo.cs -text eol=crlf
src/Logos.Utility/StringUtility.cs -text eol=crlf
tests/Logos.Utility.Tests/Ascii85Tests.cs -text eol=crlf
+tests/Logos.Utility.Tests/Ascii85HttpHeaderTests.cs -text eol=crlf
tests/Logos.Utility.Tests/GuidUtilityTests.cs -text eol=crlf
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Text;
namespace Logos.Utility
@@ -187,7 +186,6 @@ public static string Decode(string encoded)
break;
default:
throw new FormatException("Unexpected character following '~': '{0}'".FormatInvariant(encoded[i]));
-
}
break;
default:
@@ -55,6 +55,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Ascii85.cs" />
+ <Compile Include="Ascii85HttpHeader.cs" />
<Compile Include="ComponentModel\NotifyPropertyChangedUtility.cs" />
<Compile Include="DateTimeUtility.cs" />
<Compile Include="DelegateUtility.cs" />
@@ -1,5 +1,4 @@
using System;
-using System.Text;
using NUnit.Framework;
namespace Logos.Utility.Tests
@@ -11,10 +10,10 @@ public class Ascii85HttpHeaderTests
public void WikipediaSample()
{
const string c_ascii85 = @"9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,O<DJ+*.@<*K0@<6L(Df-\0Ec5e;DffZ(EZee.Bl.9pF""AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKYi(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIal(DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G>uD.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c";
- const string c_separators = "()<>;@,;:\\\"/[]?=";
+ const string c_separators = "()<>;@,;:\\\"/[]?=";
Assert.That(Ascii85HttpHeader.Decode(Ascii85HttpHeader.Encode(c_ascii85)), Is.EqualTo(c_ascii85));
- Assert.That(Ascii85HttpHeader.Decode(Ascii85HttpHeader.Encode(c_separators)), Is.EqualTo(c_separators));
+ Assert.That(Ascii85HttpHeader.Decode(Ascii85HttpHeader.Encode(c_separators)), Is.EqualTo(c_separators));
}
[TestCase("", "")]
@@ -33,11 +32,11 @@ public void WikipediaSample()
[TestCase("]", "~h")]
[TestCase("?", "~i")]
[TestCase("=", "~j")]
- [TestCase(" \r\n\t!01234567890ABCabcz-*", " \r\n\t!01234567890ABCabcz-*")]
+ [TestCase(" \r\n\t!01234567890ABCabcz-*", " \r\n\t!01234567890ABCabcz-*")]
public void RoundTrip(string plain, string encoded)
{
- Assert.That(Ascii85HttpHeader.Encode(plain), Is.EqualTo(encoded));
- Assert.That(Ascii85HttpHeader.Decode(encoded), Is.EqualTo(plain));
+ Assert.That(Ascii85HttpHeader.Encode(plain), Is.EqualTo(encoded));
+ Assert.That(Ascii85HttpHeader.Decode(encoded), Is.EqualTo(plain));
}
[Test, ExpectedException(typeof(ArgumentNullException))]
@@ -49,32 +48,32 @@ public void EncodeNull()
[Test, ExpectedException(typeof(ArgumentNullException))]
public void DecodeNull()
{
- Ascii85HttpHeader.Decode(null);
+ Ascii85HttpHeader.Decode(null);
}
-
+
[Test, ExpectedException(typeof(FormatException))]
- public void tooLow()
+ public void TooLow()
{
- Ascii85HttpHeader.Encode("\v");
+ Ascii85HttpHeader.Encode("\v");
}
[Test, ExpectedException(typeof(FormatException))]
- public void tooHigh()
+ public void TooHigh()
{
- Ascii85HttpHeader.Encode("");
+ Ascii85HttpHeader.Encode("");
}
[Test, ExpectedException(typeof(FormatException))]
- public void misplacedTilde()
+ public void MisplacedTilde()
{
Ascii85.Decode("a~z");
}
- [Test, ExpectedException(typeof(FormatException))]
- public void finalTilde()
- {
- Ascii85.Decode("~");
- }
-
+ [Test, ExpectedException(typeof(FormatException))]
+ public void FinalTilde()
+ {
+ Ascii85.Decode("~");
+ }
+
}
}
@@ -53,6 +53,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Ascii85HttpHeaderTests.cs" />
<Compile Include="Ascii85Tests.cs" />
<Compile Include="ClonableClass.cs" />
<Compile Include="DelegateUtilityTests.cs" />

0 comments on commit 929f53d

Please sign in to comment.