Skip to content

Instantly share code, notes, and snippets.

View ryansroberts's full-sized avatar

Ryan Roberts ryansroberts

View GitHub Profile
using (N2Configuration.Manual)
{
N2Cms.Has.PagesOfType<HomePage>()
.UsingResourceType<TwoColumnPageResource<HomePage>>();
N2Cms.Has.PagesOfType<TextPage>()
.UsingResourceType<TwoColumnPageResource<TextPage>>();
N2Cms.Has.PagesOfType<NewsListPage>()
.UsingResourceType<NewsListPageResource>()
var newsPage = startPage.MakeChildOfType<NewsListPage>()
.Persist();
newsPage.MakeChildrenOfType<NewsPage>(12)
.Persist();
var textPages =startPage.MakeChildrenOfType<TextPage>(3)
.Persist();
foreach (var textPage in textPages)
public class ContentResourceResolverContributor : IPipelineContributor
{
readonly IPageResourceRepository _pageResourceRepository;
readonly IPageResourceUriResolver _pageResourceUriResolver;
IEngine Engine { get; set; }
public ContentResourceResolverContributor(IEngine engine,IPageResourceRepository pageResourceRepository,IPageResourceUriResolver pageResourceUriResolver)
{
_pageResourceRepository = pageResourceRepository;
_pageResourceUriResolver = pageResourceUriResolver;
<%= Html.PagerFor(i => Html.ActionLink(i.ToString(),"Index","Technology",null,null,"audit",new {auditPage = i},null)) %>
AutoMap.Assemblies(AdditionalAssemblies.Concat(New () {Assembly.GetExecutingAssembly()}).ToArray()) _
.Where(Function(t) GetType(IEntity).IsAssignableFrom(t) OrElse t = GetType(TechnologySequence) OrElse t = GetType(DrugSequence) OrElse GetType(IEvent).IsAssignableFrom(t)) _
.Setup(Function(s) InlineAssignHelper(s.IsComponentType, Function(type) GetType(IValueObject).IsAssignableFrom(type)))_
.IncludeBase(GetType([Event])) _
.IncludeBase(GetType(AggregateEvent))_
.IncludeBase(GetType(ChangedCompanyUsers))
.Conventions _.AddFromAssemblyOf(Of PrimaryKeyNameConvention)().UseOverridesFromAssemblyOf(Of IEntity)()
public class When_searching_for_a_tag_by_name_with_two_matches : HandlerContext<IEnumerable<TagResource>, TagsController>
{
Establish context = () => Stub<ISemaphoreService>()
.Setup(s => s.ByName(Moq.It.IsAny<string>()))
.Returns(new[] { new Term(1, "encoded term that is ambiguous"),
new Term(2, "encoded term that is ambiguous") });
Because of = () => Get("tags/byname/encoded+term+that+is+ambiguous");
It Has_a_resource_of_enumerable_tags = () => Has_expected_resource_type();
Will render the View 'Document' as the convention is from model type. If there's no view (or you force the content type), it will render it as xml / json / text/plain depending on negotiation
public static class Extensions
{
public static ResourceResult NotFoundOnNull<TResult>(this ResourceController controller,Func<TResult> f) where TResult:class
{
var result = f();
return result == null ? controller.NotFound() : controller.OK(result);
}
public class Source
{
public class Child
{
public string Name {get;set;}
}
public IEnumerable<Child> Children {get;set;}
}
describe 'selecting a related term in the term viewer'
before_each
model = new ko.tagging.viewmodel()
tagging = $('#taggingContainer').tagging()
tagging.tagging("setmodel",model)
mock_request().and_return({Id : 1,Name: "test1",Paths:[ ],RelatedTo:[],BroaderTerms:[],NarrowerTerms:[]},'application/json')
model.termviewerviewmodel.selectedTerm({Id: 1, Name: "Tag 1"})
end
it 'changes the currently selected term'
model.termviewerviewmodel.term().should.not.be_null
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