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); }
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); } } }