Skip to content

Instantly share code, notes, and snippets.

@ryansroberts
Created August 20, 2010 10:53
Show Gist options
  • Save ryansroberts/540063 to your computer and use it in GitHub Desktop.
Save ryansroberts/540063 to your computer and use it in GitHub Desktop.
public class SyndicatedContent
{
public string Id { get; set; }
public JObject unknown { get; set; }
public XDocument doc { get; set; }
}
[Subject("Document storage")]
public class When_storing_content
{
static DocumentStore store;
static IDocumentSession session;
static string id;
Establish context = () =>
{
store = new DocumentStore() {DataDirectory = "./data"};
store.Initialize();
session = store.OpenSession();
};
Because of = () =>
{
SyndicatedContent entry;
session.Store(entry = new SyndicatedContent
{
unknown = JObject.Parse("{bob : [1,2,3,4]})"),
doc = XDocument.Parse("<blah></blah>")
});
session.SaveChanges();
id = entry.Id;
session.Evict(entry);
};
It has_the_document = () => session.Load < SyndicatedContent>(id)
.unknown.ShouldNotBeNull();
It has_the_xml_document = () => session.Load<SyndicatedContent>(id)
.doc.ShouldNotBeNull();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment