Beispiel #1
0
        public void SOX_GetResponseProviderTest()
        {
            Mock <ISeverityRepo> mock = new Mock <ISeverityRepo>();

            mock.Setup(p => p.Response()).Returns(ls);
            SeverityProvider cp  = new SeverityProvider(mock.Object);
            AuditRequest     req = new AuditRequest()
            {
                Auditdetails = new AuditDetail()
                {
                    Type      = "Internal",
                    questions = new Questions()
                    {
                        Question1 = true,
                        Question2 = false,
                        Question3 = false,
                        Question4 = false,
                        Question5 = false
                    }
                }
            };
            AuditResponse result = cp.SeverityResponse(req);

            Assert.AreEqual("RED", result.ProjectExexutionStatus);
        }
Beispiel #2
0
        public void Internal_SeverityResponse_InalidOutput_BadRequest()
        {
            Mock <ISeverityRepo> mock = new Mock <ISeverityRepo>();

            mock.Setup(p => p.Response()).Returns(l2);
            SeverityProvider cp  = new SeverityProvider(mock.Object);
            AuditRequest     req = new AuditRequest()
            {
                Auditdetails = new AuditDetail()
                {
                    Type      = "Internal",
                    questions = new Questions()
                    {
                        Question1 = true,
                        Question2 = true,
                        Question3 = false,
                        Question4 = false,
                        Question5 = true
                    }
                }
            };
            AuditResponse result = cp.SeverityResponse(req);

            Assert.AreNotEqual("GREEN", result.ProjectExexutionStatus);
        }
        public IActionResult AuditResponseSOXView(SOXQuestions questions)
        {
            try
            {
                _log4net.Info(" Http POST request " + nameof(AuditResponseSOXView) + " method called");
                string Token = HttpContext.Request.Cookies["Token"];
                if (string.IsNullOrEmpty(Token))
                {
                    ViewBag.Message = "Please Login";
                    return(View("Login"));
                }

                AuditResponse    auditResponse    = new AuditResponse();
                SeverityProvider severityProvider = new SeverityProvider(config);
                auditResponse = severityProvider.GetResponseforSOX(questions, Token);

                Storage objOfStorage = new Storage();
                objOfStorage.add(auditResponse);
                context.AuditResponse.Add(auditResponse);
                context.SaveChanges();

                return(View(auditResponse));
            }
            catch (Exception e)
            {
                _log4net.Error("Error From GET " + nameof(AuditResponseSOXView) + " Error Message: " + e.Message);
                return(View("Error"));
            }
        }
        public IActionResult Post([FromBody] AuditRequest req)    //Change Here
        {
            SeverityProvider obj = new SeverityProvider();

            var response = obj.SeverityResponse(req);

            if (response == null)
            {
                return(BadRequest());
            }


            return(Ok(response));
        }
        public void Post()
        {
            SeverityProvider obj = new SeverityProvider();

            obj.SeverityResponse(new AuditRequest());
        }