예제 #1
0
        public static RawData CreateRawData(string url, IFilter filter, string rawContent)
        {
            string buildRawDataId()
            {
                return($"{url}{filter.AsQueryString()}{rawContent}".GetCrc());
            }

            return(new RawData
            {
                Id = buildRawDataId(),
                Url = url,
                Filter = filter.AsQueryString(),
                Visited = DateTime.Now.ToDateTimeOffset(Globals.Configuration.TryGet <double>(UtcHoursOffsetConfigKey)),
                RawContent = rawContent
            });
        }
        private static RawData GetRawDataFakeResult(int amount, string source, IFilter filter, Func <int, string> rawContentProducer)
        {
            var rawContent = rawContentProducer(amount);

            var baseUrl = $"http://mock.it/{source}";

            return(new RawData
            {
                Id = baseUrl.GetCrc(),
                Url = baseUrl,
                Filter = filter.AsQueryString(),
                Visited = DateTime.Now,
                Parsed = default,