Exemple #1
0
        public Model_Tests()
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters["param"] = "paramvalue";

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers["header"] = "headervalue";


            List <StatisticalDocument> stat = new List <StatisticalDocument>();

            stat.Add(new StatisticalDocument()
            {
                Call           = "testcall",
                Comment        = "testcomment",
                ElapsedSeconds = 23
            });

            _basedoc = new ElasticsearchBaseDocument("id", "logname", "appname", message: "message", path: "path"
                                                     , controllerName: "controller", actionName: "action"
                                                     , elapsedSeconds: 0.1, parameters: parameters, resultCode: 200);

            _accesslogdoc = new ElasticsearchAccessLogDocument("id", "logname", "appname", message: "message", path: "path"
                                                               , controllerName: "controller", actionName: "action"
                                                               , elapsedSeconds: 0.1, parameters: parameters, resultCode: 200, stat: stat, headers: headers);

            _errorlogdoc = new ElasticsearchErrorDocument("id", new Exception("extest"), "logname", "appname", message: "message", path: "path"
                                                          , controllerName: "controller", actionName: "action"
                                                          , elapsedSeconds: 0.1, parameters: parameters, resultCode: 200, inputData: Encoding.UTF8.GetBytes("input\x0001data\x0002"));
        }
Exemple #2
0
        public void BaseDocumentTestClone()
        {
            var d = new ElasticsearchBaseDocument();

            _basedoc.CloneTo(d);
            check_basedoc(d);
        }
Exemple #3
0
        public void BaseDocumentTest01()
        {
            var d = new ElasticsearchBaseDocument("id", "logname", "appname");

            Assert.True(d.Timestamp <DateTime.Now && d.Timestamp> DateTime.Now.AddSeconds(-1), "Base document timestamp is not valid");
            Assert.Equal("id", d.Id);
            Assert.Equal("logname", d.LogName);
            Assert.Equal("appname", d.AppName);
        }
Exemple #4
0
        private void check_basedoc(ElasticsearchBaseDocument d)
        {
            Assert.True(d.Timestamp <DateTime.Now && d.Timestamp> DateTime.Now.AddSeconds(-1), "Base document timestamp is not valid");
            Assert.Equal("id", d.Id);
            Assert.Equal("logname", d.LogName);
            Assert.Equal("appname", d.AppName);
            Assert.Equal("message", d.Message);

            Assert.Equal("path", d.Path);
            Assert.Equal("controller", d.ControllerName);
            Assert.Equal("action", d.ActionName);
            Assert.Equal(0.1, d.ElapsedSeconds);
            Assert.Equal(200, d.ResultCode);

            Assert.Single(d.RequestParameters);
            Assert.Equal("paramvalue", d.RequestParameters["param"]);
        }