public void IndexTest_UpdateStatus()
        {
            ClientsListModel model = new ClientsListModel();

            List <int> ClientIds = null;

            ClientIds = CC.Data.Tests.Helper.GetTestClientIdsList();
            model.UpdateModel.SelectedClientIds   = ClientIds;
            model.UpdateModel.NewApprovalStatusId = (int)ApprovalStatusEnum.Approved;

            ActionResult actual = Target.Index(model);

            Assert.IsNotNull(actual, "action result can not be null");

            string content = ((System.Web.Mvc.ContentResult)actual).Content;

            Assert.IsTrue(content == "3 records updated.", "result must be:3 records updated. ");

            List <Client> updClients = CC.Data.Tests.Helper.GetTestClientsList(); //clients after changed


            foreach (Client cl in updClients)
            {
                if (cl.ApprovalStatusId != (int)ApprovalStatusEnum.Approved)
                {
                    Assert.Inconclusive("Approval status for client " + cl.FirstName + " not updated ");
                }
            }
        }
        public ClientsListViewModel()
        {
            Model = new ClientsListModel();
            Init();

            Model.AllClientsChanged += OnClientsChanged;
            Model.BookingsChanged   += Init;
        }
        public void IndexTest_TryUpdateStatus_NotSelectedClients()
        {
            //try to change approval status without select clients
            target = GetTarget_ForUser(FixedRoles.Admin);
            mocks  = new ContextMocks(target, true, false);
            ClientsListModel model = new ClientsListModel();

            model.UpdateModel.SelectedClientIds   = null;
            model.UpdateModel.NewApprovalStatusId = (int)ApprovalStatusEnum.Approved;



            ActionResult actual = target.Index(model);

            Assert.IsNotNull(actual, "action result can not be null");
            string content = ((System.Web.Mvc.ContentResult)actual).Content;

            Assert.IsTrue(content == "selection is empty", "result must be:selection is empty");
        }
        public void IndexTest_TryUpdateStatus_NotAdmin()
        {
            //try to change approval status without select clients

            ClientsListModel model     = new ClientsListModel();
            List <int>       ClientIds = null;

            ClientIds = CC.Data.Tests.Helper.GetTestClientIdsList();
            model.UpdateModel.SelectedClientIds = ClientIds;

            model.UpdateModel.NewApprovalStatusId = (int)ApprovalStatusEnum.Approved;



            ActionResult actual = Target.Index(model);

            Assert.IsNotNull(actual, "action result can not be null");
            string content = ((System.Web.Mvc.ContentResult)actual).Content;

            Assert.IsTrue(content == "You are not allowed to change the approval status", "Only admin can update approval status");
        }
        public void IndexTest_TryUpdateStatus_NotSelectedStatus()
        {
            //try to change approval status widthout select status value

            ClientsListModel model = new ClientsListModel();

            List <int> ClientIds = null;

            ClientIds = CC.Data.Tests.Helper.GetTestClientIdsList();
            model.UpdateModel.SelectedClientIds   = ClientIds;
            model.UpdateModel.NewApprovalStatusId = 0;


            // var mocks = new ContextMocks(Target, true, false);
            ActionResult actual = Target.Index(model);


            Assert.IsNotNull(actual, "action result can not be null");

            string content = ((System.Web.Mvc.ContentResult)actual).Content;

            Assert.IsTrue(content == "0 records updated.", "result must be:0 records updated.");
        }