Skip to content

Instantly share code, notes, and snippets.

@hhariri
Created December 29, 2010 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhariri/759053 to your computer and use it in GitHub Desktop.
Save hhariri/759053 to your computer and use it in GitHub Desktop.
[Subject("Encoding Enums")]
public class when_encoding_an_object_that_contains_an_enum
{
Establish context = () =>
{
IEnumerable<IDataReader> readers = new List<IDataReader> { new JsonReader(new DataReaderSettings(), "application/.*json") };
IEnumerable<IDataWriter> writers = new List<IDataWriter> { new JsonWriter(new DataWriterSettings(), "application/.*json") };
codec = new DefaultCodec(new RegExBasedDataReaderProvider(readers), new RegExBasedDataWriterProvider(writers));
};
Because of = () =>
{
var data = new Foo {Baz = Bar.First};
result = codec.Encode(data, "application/vnd.fubar+json");
};
It should_encode_correctly = () =>
{
result.Length.ShouldBeGreaterThan(0);
};
static HttpClient client;
static DefaultCodec codec;
static byte[] result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment