Skip to content

Instantly share code, notes, and snippets.

@rofr
Created September 17, 2014 04:14
Show Gist options
  • Save rofr/03e635ddb6beea5dae7d to your computer and use it in GitHub Desktop.
Save rofr/03e635ddb6beea5dae7d to your computer and use it in GitHub Desktop.
Building a CMS with OrigoDB - snippet 8
[TestMethod()]
public void MenuSmokeTest()
{
var engine = Engine.LoadOrCreate<CmsModel>("c:\\livedb\\cms");
var page = new Page(Guid.NewGuid(), DateTime.Now);
page.Contents = "Hello, world!";
Command command = new PutPageCommand(page);
engine.Execute(command);
Menu menu = new Menu{Name = "_main"};
menu.Items.Add(new ExternalMenuItem{ Name = "squash", Url = "http://psasquashtv.com/"});
menu.Items.Add(new ExternalMenuItem{ Name = "livedb", Url = "http://livedb.devrex.se/"});
menu.Items.Add(new InternalMenuItem{Name = page.Title, PageId = page.Id});
var subMenu = new Menu(){Name = "Events"};
menu.Items.Add(subMenu);
subMenu.Items.Add(new ExternalMenuItem{ Name = "News", Url = "http://dn.se/"});
command = new PutMenuCommand(menu);
engine.Execute(command);
engine.Close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment