public void AddEvent_throws_if_items_is_not_a_list() { var context = CreateHttpContext(); context.Items[Stactive.StactiveEventsKey] = ""; var ex = Should.Throw <StactiveException>(() => Stactive.AddEvent(context, null)); ex.Message.ShouldBe("Stactive events is not a List<StactiveEvent>"); }
public void AddEvent_creates_list_in_context() { var context = CreateHttpContext(); Stactive.AddEvent(context, null); context.Items.ShouldContainKey(Stactive.StactiveEventsKey); context.Items[Stactive.StactiveEventsKey].ShouldNotBeNull(); context.Items[Stactive.StactiveEventsKey].ShouldBeOfType <List <StactiveEvent> >(); }
public void AddEvent_adds_event_to_the_list() { var stactiveEvent = new StactiveEvent("asd"); var context = CreateHttpContext(); Stactive.AddEvent(context, stactiveEvent); var eventsList = context.Items[Stactive.StactiveEventsKey] as List <StactiveEvent>; eventsList.ShouldContain(stactiveEvent); }
public IActionResult Index() { Stactive.AddEvent(HttpContext, new StactiveEvent("Home Index view")); return(View()); }