Example #1
0
        public void Test1Audit()
        {
            // Arrange
            var actionModel = new ActionAuditModel();
            var mockrepo    = new Mock <IAuditRepository>();
            var mockhttp    = new Mock <IHttpContextAccessor>();

            mockrepo.Setup(serv => serv.AuditAction(actionModel));
            var controller = new AuditController(mockrepo.Object, mockhttp.Object);

            // Act
            controller.Post(actionModel);
        }
Example #2
0
        public void Test1AuditInsert()
        {
            var model = new ActionAuditModel
            {
                Action    = "Test1Auditinsert",
                Component = "TestAuditRepository",
                User      = "******",
                Value     = "test"
            };

            repository.AuditAction(model);

            var newModel = repository.GetAction(model);

            Assert.IsTrue(model.User.Equals(newModel.User));
            Assert.IsTrue(model.Action.Equals(newModel.Action));
            Assert.IsTrue(model.Component.Equals(newModel.Component));
            Assert.IsTrue(model.Value.Equals(newModel.Value));
        }
Example #3
0
        public ActionAuditModel GetAction(ActionAuditModel model)
        {
            var cmd = string.Format(FindAuditCommand, model.User, model.Component, model.Action, model.Value);

            return(Find <ActionAuditModel>(cmd));
        }
Example #4
0
 public void AuditAction(ActionAuditModel model)
 {
     Add(model, AuditActionCommand);
 }
Example #5
0
 public void Post([FromBody] ActionAuditModel model)
 {
     Repo.AuditAction(model);
 }
 public void Audit(ActionAuditModel model)
 {
     Post(model);
 }