Ejemplo n.º 1
0
        public void StackSummaryData(string path)
        {
            var settings = IoC.GetInstance <JsonSerializerSettings>();

            settings.Formatting = Formatting.Indented;

            var json = File.ReadAllText(path);

            var stack = json.FromJson <Stack>(settings);

            Assert.NotNull(stack);

            var data    = _formattingPluginManager.GetStackSummaryData(stack);
            var summary = new StackSummaryModel {
                TemplateKey = data.TemplateKey,
                Data        = data.Data,
                Id          = stack.Id,
                Title       = stack.Title,
                New         = 1,
                Total       = 1,
                Unique      = 1,
                Timeline    = new List <TermTimelineItem>()
            };

            ApprovalsUtility.VerifyFile(Path.ChangeExtension(path, "summary.json"), JsonConvert.SerializeObject(summary, settings));
        }
Ejemplo n.º 2
0
        public void VerifyEventParserSerialization(string eventsFilePath)
        {
            var json = File.ReadAllText(eventsFilePath);

            var events = _eventParserPluginManager.ParseEvents(json, 2, "exceptionless/2.0.0.0");

            Assert.Equal(1, events.Count);

            ApprovalsUtility.VerifyFile(eventsFilePath, events.First().ToJson(Formatting.Indented, IoC.GetInstance <JsonSerializerSettings>()));
        }
Ejemplo n.º 3
0
        public async Task VerifyEventParserSerialization(string eventsFilePath)
        {
            string json = File.ReadAllText(eventsFilePath);

            var events = await _parser.ParseEventsAsync(json, 2, "exceptionless/2.0.0.0");

            Assert.Equal(1, events.Count);

            ApprovalsUtility.VerifyFile(eventsFilePath, events.First().ToJson(Formatting.Indented, GetService <JsonSerializerSettings>()));
        }
Ejemplo n.º 4
0
        public void VerifyEventParserSerialization(string eventsFilePath)
        {
            string json = File.ReadAllText(eventsFilePath);

            var events = _parser.ParseEvents(json, 2, "exceptionless/2.0.0.0");

            Assert.Single(events);

            ApprovalsUtility.VerifyFile(eventsFilePath, events.First().ToJson(Formatting.Indented, GetService <JsonSerializerSettings>()));
        }
Ejemplo n.º 5
0
        public void ParseErrors(string errorFilePath)
        {
            var json = File.ReadAllText(errorFilePath);
            var ctx  = new EventUpgraderContext(json);

            _upgrader.Upgrade(ctx);
            ApprovalsUtility.VerifyFile(Path.ChangeExtension(errorFilePath, ".expected.json"), ctx.Documents.First.ToString());

            var events = _parser.ParseEvents(ctx.Documents.ToString(), 2, "exceptionless/2.0.0.0");

            Assert.Equal(1, events.Count);
        }
Ejemplo n.º 6
0
        public void ParseEvents(string errorFilePath)
        {
            var json = File.ReadAllText(errorFilePath);
            var ctx  = new EventUpgraderContext(json);

            // TODO: Figure out what is wrong with 800000002e519522d83837a1
            _eventUpgraderPluginManager.Upgrade(ctx);
            ApprovalsUtility.VerifyFile(Path.ChangeExtension(errorFilePath, ".expected.json"), ctx.Documents.First.ToString());

            var events = _eventParserPluginManager.ParseEvents(ctx.Documents.ToString(), 2, "exceptionless/2.0.0.0");

            Assert.Equal(1, events.Count);
        }
Ejemplo n.º 7
0
        public void CanCreateFromStack(Version version, bool expectData)
        {
            var data = _webHookDataPluginManager.CreateFromStack(GetWebHookDataContext(version));

            if (expectData)
            {
                string filePath = String.Format(@"..\..\Plugins\WebHookData\v{0}.stack.expected.json", version);
                ApprovalsUtility.VerifyFile(filePath, JsonConvert.SerializeObject(data, Formatting.Indented));
            }
            else
            {
                Assert.Null(data);
            }
        }
Ejemplo n.º 8
0
        public async Task CanCreateFromStackAsync(Version version, bool expectData)
        {
            var settings = GetService <JsonSerializerSettings>();

            settings.Formatting = Formatting.Indented;
            var data = await _webHookData.CreateFromStackAsync(GetWebHookDataContext(version));

            if (expectData)
            {
                string filePath = $@"..\..\Plugins\WebHookData\v{version}.stack.expected.json";
                ApprovalsUtility.VerifyFile(filePath, JsonConvert.SerializeObject(data, settings));
            }
            else
            {
                Assert.Null(data);
            }
        }
Ejemplo n.º 9
0
        public async Task CreateFromEventAsync(Version version, bool expectData)
        {
            var settings = GetService <JsonSerializerSettings>();

            settings.Formatting = Formatting.Indented;
            object data = await _webHookData.CreateFromEventAsync(GetWebHookDataContext(version));

            if (expectData)
            {
                string filePath = Path.GetFullPath(Path.Combine("..", "..", "..", "Plugins", "WebHookData", $"v{version}.event.expected.json"));
                ApprovalsUtility.VerifyFile(filePath, JsonConvert.SerializeObject(data, settings));
            }
            else
            {
                Assert.Null(data);
            }
        }
Ejemplo n.º 10
0
        public void CreateFromEvent(Version version, bool expectData)
        {
            var settings = IoC.GetInstance <JsonSerializerSettings>();

            settings.Formatting = Formatting.Indented;
            var data = _webHookDataPluginManager.CreateFromEvent(GetWebHookDataContext(version));

            if (expectData)
            {
                string filePath = String.Format(@"..\..\Plugins\WebHookData\v{0}.event.expected.json", version);
                ApprovalsUtility.VerifyFile(filePath, JsonConvert.SerializeObject(data, settings));
            }
            else
            {
                Assert.Null(data);
            }
        }
Ejemplo n.º 11
0
        public void EventSummaryData(string path)
        {
            var settings = IoC.GetInstance <JsonSerializerSettings>();

            settings.Formatting = Formatting.Indented;

            var json = File.ReadAllText(path);

            var ev = json.FromJson <PersistentEvent>(settings);

            Assert.NotNull(ev);

            var data    = _formattingPluginManager.GetEventSummaryData(ev);
            var summary = new EventSummaryModel {
                TemplateKey = data.TemplateKey,
                Id          = ev.Id,
                Date        = ev.Date,
                Data        = data.Data
            };

            ApprovalsUtility.VerifyFile(Path.ChangeExtension(path, "summary.json"), JsonConvert.SerializeObject(summary, settings));
        }
        public void StackSummaryData(string path)
        {
            var settings = GetService <JsonSerializerSettings>();

            settings.Formatting = Formatting.Indented;

            string json  = File.ReadAllText(path);
            var    stack = json.FromJson <Stack>(settings);

            Assert.NotNull(stack);

            var data    = _formatter.GetStackSummaryData(stack);
            var summary = new StackSummaryModel {
                TemplateKey = data.TemplateKey,
                Data        = data.Data,
                Id          = stack.Id,
                Title       = stack.Title,
                Total       = 1,
            };

            ApprovalsUtility.VerifyFile(Path.ChangeExtension(path, "summary.json"), JsonConvert.SerializeObject(summary, settings));
        }