예제 #1
0
        public void StactiveEvent_constructor_sets_datetime()
        {
            var stactiveEvent = new StactiveEvent("asd");

            stactiveEvent.DateTime.ShouldNotBe(new DateTime());
            stactiveEvent.DateTime.Kind.ShouldBe(DateTimeKind.Utc);
        }
예제 #2
0
        public void StactiveEvent_constructor_sets_id_to_guid()
        {
            var stactiveEvent = new StactiveEvent("asd");

            stactiveEvent.Id.ShouldNotBeNull();
            stactiveEvent.Id.ShouldNotBe(new Guid());
        }
예제 #3
0
        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);
        }
예제 #4
0
파일: Stactive.cs 프로젝트: mdymel/stactive
        public static void AddEvent(HttpContext context, StactiveEvent stactiveEvent)
        {
            if (!context.Items.ContainsKey(StactiveEventsKey))
            {
                context.Items[StactiveEventsKey] = new List <StactiveEvent>();
            }
            var list = context.Items[StactiveEventsKey] as List <StactiveEvent>;

            if (list is null)
            {
                throw new StactiveException("Stactive events is not a List<StactiveEvent>");
            }
            list.Add(stactiveEvent);
        }
예제 #5
0
        public void StactiveEvent_constructor_sets_name()
        {
            var stactiveEvent = new StactiveEvent("asd");

            stactiveEvent.Name.ShouldBe("asd");
        }