public void ErrorSyncResponse400()
        {
            newError = new ErrorRequestDTO();
            newError.setSource(DTO.Constants.Constants.Sources.AdminDashboard);
            newError = (ErrorRequestDTO)_tu.getLogContent(newError);
            var responseStatus = _ls.sendLogSync(newError);

            Assert.AreEqual(responseStatus, System.Net.HttpStatusCode.BadRequest);
        }
        public void ErrorSyncResponse401()
        {
            newError = new ErrorRequestDTO();
            newError.setSource(DTO.Constants.Constants.Sources.AdminDashboard);
            newError.details = "This is a test error";
            var responseStatus = _ls.sendLogSync(newError);

            Assert.AreEqual(responseStatus, System.Net.HttpStatusCode.Unauthorized);
        }
Example #3
0
        public void SendErrors()
        {
            ErrorRequestDTO newError = new ErrorRequestDTO();
            LoggingService  _ls      = new LoggingService();

            newError.details = "testing stacktrace";
            Random rand = new Random();

            for (var i = 0; i < 20; i++)
            {
                User    newUser    = CreateUserObject();
                Session newSession = CreateSessionObject(newUser);
                CreateSessionInDb(newSession);
                newError.ssoUserId = newUser.Id.ToString();
                var month = rand.Next(1, 5);
                newError.logCreatedAt = new DateTime(2019, month, 21);
                for (var j = 0; j < 3; j++)
                {
                    newError.setSource(DTO.Constants.Constants.Sources.Login);
                    if (j == 0)
                    {
                        newError.setSource(DTO.Constants.Constants.Sources.Registration);
                    }
                    var duration = rand.Next(1, 1000);
                    if (duration < 300)
                    {
                        newError.setSource(DTO.Constants.Constants.Sources.PointEditor);
                    }
                    else if (duration < 500)
                    {
                        newError.setSource(DTO.Constants.Constants.Sources.Mapview);
                    }

                    newError = (ErrorRequestDTO)getLogContent(newError);
                    _ls.sendLogSync(newError);
                }
            }
        }
 public async Task sendErrorAsyncFail()
 {
     newError = new ErrorRequestDTO();
     Assert.IsFalse(await logger.sendLogAsync(newError));
 }
 public void sendErrorSyncFail()
 {
     newError = new ErrorRequestDTO();
     Assert.IsFalse(logger.sendLogSync(newError));
 }
 public async Task sendErrorAsyncPass()
 {
     newError = new ErrorRequestDTO("This is a new error log", DTO.Constants.Constants.Sources.AdminDashboard);
     Assert.IsTrue(await logger.sendLogAsync(newError));
 }
 public void sendErrorSyncPass()
 {
     newError = new ErrorRequestDTO("This is a new error log", DTO.Constants.Constants.Sources.AdminDashboard);
     Assert.IsTrue(logger.sendLogSync(newError));
 }