public void BuildDetails(TimerResult timerResult, bool isChildAction, Type executedType, MethodInfo method, string eventName, TimelineCategory eventCategory)
        {
            var message = new ActionBaseMessage(timerResult, isChildAction, executedType, method, eventName, eventCategory);

            var dictionary = new Dictionary<string, object>();
            message.BuildDetails(dictionary);

            Assert.Equal(3, dictionary.Count); 
            Assert.Equal(isChildAction, dictionary["IsChildAction"]);
            Assert.Equal(method.Name, dictionary["ExecutionMethod"]); 
            Assert.Equal(executedType, dictionary["ExecutedType"]);
        }
        public void Construct(TimerResult timerResult, bool isChildAction, Type executedType, MethodInfo method, string eventName, TimelineCategory eventCategory)
        {
            var message = new ActionBaseMessage(timerResult, isChildAction, executedType, method, eventName, eventCategory);

            Assert.Equal(timerResult.Duration, message.Duration);
            Assert.Equal(timerResult.Offset, message.Offset);
            Assert.Equal(timerResult.StartTime, message.StartTime);
            Assert.Equal(eventName, message.EventName);
            Assert.Equal(eventCategory, message.EventCategory);
            Assert.Equal(eventCategory, message.EventCategory);
            Assert.Equal(executedType, message.ExecutedType);
            Assert.Equal(method, message.ExecutedMethod); 
        }
Example #3
0
        public static Uri GetTimelineUri(WebsiteKind websiteKind, TimelineCategory category, TimelineSorting sorting,
                                         int count = -1, int offset = -1, double apiVersion = Core.ApiVersion)
        {
            var baseUri = Core.GetBaseUri(websiteKind, apiVersion);

            UriBuilder builder = new($"{baseUri}/timeline/{category}/{sorting}");

            string countQuery  = count > -1 ? $"count={count}" : null;
            string offsetQuery = offset > -1 ? $"offset={offset}" : null;

            Core.BuildUri(ref builder, countQuery, offsetQuery);

            return(builder.Uri);
        }
Example #4
0
        public static Uri GetTimelineByHashtagUri(WebsiteKind websiteKind, string hashtag,
                                                  TimelineCategory category = TimelineCategory.MainPage, TimelineSorting sorting = TimelineSorting.Recent,
                                                  int limit = -1, int lastId = -1, double apiVersion = Core.ApiVersion)
        {
            var baseUri = Core.GetBaseUri(websiteKind, apiVersion);

            UriBuilder builder = new($"{baseUri}/timeline/{category}/{sorting}");

            string limitQuery  = limit > -1 ? $"limit={limit}" : null;
            string lastIdQuery = lastId > -1 ? $"last_id={lastId}" : null;

            Core.BuildUri(ref builder, hashtag, limitQuery, lastIdQuery);

            return(builder.Uri);
        }
Example #5
0
        public void BuildDetails(TimerResult timerResult, bool isChildAction, Type executedType, MethodInfo method, string eventName, TimelineCategory eventCategory)
        {
            var message = new ActionBaseMessage(timerResult, isChildAction, executedType, method, eventName, eventCategory);

            var dictionary = new Dictionary <string, object>();

            message.BuildDetails(dictionary);

            Assert.Equal(3, dictionary.Count);
            Assert.Equal(isChildAction, dictionary["IsChildAction"]);
            Assert.Equal(method.Name, dictionary["ExecutionMethod"]);
            Assert.Equal(executedType, dictionary["ExecutedType"]);
        }
Example #6
0
        public void Construct(TimerResult timerResult, bool isChildAction, Type executedType, MethodInfo method, string eventName, TimelineCategory eventCategory)
        {
            var message = new ActionBaseMessage(timerResult, isChildAction, executedType, method, eventName, eventCategory);

            Assert.Equal(timerResult.Duration, message.Duration);
            Assert.Equal(timerResult.Offset, message.Offset);
            Assert.Equal(timerResult.StartTime, message.StartTime);
            Assert.Equal(eventName, message.EventName);
            Assert.Equal(eventCategory, message.EventCategory);
            Assert.Equal(eventCategory, message.EventCategory);
            Assert.Equal(executedType, message.ExecutedType);
            Assert.Equal(method, message.ExecutedMethod);
        }
Example #7
0
        public static async ValueTask <IEnumerable <Entry> > GetTimelineByHashtagAsync(HttpClient client, WebsiteKind websiteKind, string hashtag,
                                                                                       TimelineCategory category,
                                                                                       TimelineSorting sorting, int limit = -1, int lastId = -1, double apiVersion = Core.ApiVersion)
        {
            var response = await GetTimelineByHashtagResponseAsync(client, websiteKind, hashtag, category, sorting, limit, lastId, apiVersion).ConfigureAwait(false);

            return(await Core.DeserializeOsnovaResponseAsync <IEnumerable <Entry> >(response).ConfigureAwait(false));
        }
Example #8
0
 public static ValueTask <HttpResponseMessage> GetTimelineByHashtagResponseAsync(HttpClient client, WebsiteKind websiteKind,
                                                                                 string hashtag, TimelineCategory category, TimelineSorting sorting, int limit = -1, int lastId = -1, double apiVersion = Core.ApiVersion)
 {
     return(Core.GetResponseFromApiAsync(client, GetTimelineByHashtagUri(websiteKind, hashtag, category, sorting, limit, lastId, apiVersion)));
 }
Example #9
0
        public static async ValueTask <IEnumerable <Entry> > GetTimelineAsync(HttpClient client, WebsiteKind websiteKind, TimelineCategory category,
                                                                              TimelineSorting sorting, int count = -1, int offset = -1, double apiVersion = Core.ApiVersion)
        {
            var response = await GetTimelineResponseAsync(client, websiteKind, category, sorting, count, offset, apiVersion).ConfigureAwait(false);

            return(await Core.DeserializeOsnovaResponseAsync <IEnumerable <Entry> >(response).ConfigureAwait(false));
        }
Example #10
0
 public static ValueTask <HttpResponseMessage> GetTimelineResponseAsync(HttpClient client, WebsiteKind websiteKind, TimelineCategory category,
                                                                        TimelineSorting sorting, int count = -1, int offset = -1, double apiVersion = Core.ApiVersion)
 {
     return(Core.GetResponseFromApiAsync(client, GetTimelineUri(websiteKind, category, sorting, count, offset, apiVersion)));
 }