示例#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
        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");
        }