示例#1
0
        public ChecklistTemplateENT UpdateSelectSingle(ChecklistTemplateENT Obj)
        {
            NbkDbEntities     dbcontext = new NbkDbEntities();
            ChecklistTemplate Data      = new ChecklistTemplate()
            {
                Id        = Obj.Id,
                Title     = Obj.Title,
                IsDefault = Obj.IsDefault
            };


            dbcontext.ChecklistTemplate.Attach(Data);
            var update = dbcontext.Entry(Data);

            update.Property(x => x.Title).IsModified     = true;
            update.Property(x => x.IsDefault).IsModified = true;
            dbcontext.SaveChanges();

            if (Obj.ServiceSelectedID > 0)
            {
                var ServiceDetail = dbcontext.Service.Where(x => x.Id == Obj.ServiceSelectedID).FirstOrDefault();
                ServiceDetail.ChecklistTempId = Obj.Id;
                dbcontext.SaveChanges();
                var PreviousService = dbcontext.Service.Where(x => x.ChecklistTempId == Obj.Id && x.Id != Obj.ServiceSelectedID).FirstOrDefault();
                if (PreviousService != null)
                {
                    PreviousService.ChecklistTempId = null;
                    dbcontext.SaveChanges();
                }
            }


            return(Obj);
        }
        public void Given_existing_template_set_to_deleted_then_deletes_variable_is_set()
        {
            // given
            var template = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1" };

            _checklistTemplateRepository
                .Setup(x => x.GetById(It.IsAny<Guid>()))
                .Returns(() => template);

            _checklistTemplateRepository
               .Setup(x => x.SaveOrUpdate(It.IsAny<ChecklistTemplate>()))
                               .Callback(
                   delegate(ChecklistTemplate x)
                   {
                       template = x;
                   }
               );

            // when
            var controller = GetTarget();
            var result = controller.DeleteTemplate(template.Id);

            //then
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            _checklistTemplateRepository.Verify(x => x.SaveOrUpdate(It.Is<ChecklistTemplate>(r => r.Deleted == true)));
        }
        public void Given_industry_When_update_industry_is_called_Then_industry_values_are_updated()
        {
            var industry = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1", Draft = true};

            _industryRepository
                  .Setup(x => x.GetById(industry.Id))
                  .Returns(() => industry);

            ChecklistTemplate updatedTemplate = null;
            _industryRepository
                .Setup(x => x.SaveOrUpdate( It.IsAny<ChecklistTemplate>()))
                .Callback(
                    delegate(ChecklistTemplate x)
                    {
                        updatedTemplate = x;
                    }
                );

            var controller = GetTarget();

            IndustryViewModel model = new IndustryViewModel()
                                          {
                                              Id = industry.Id,
                                              Draft = false,
                                              Title = "Updated Title"
                                          };

            controller.UpdateIndustry(model);

            Assert.That(updatedTemplate.Id, Is.EqualTo(model.Id));
            Assert.That(updatedTemplate.Name, Is.EqualTo(model.Title));
            Assert.That(updatedTemplate.Draft, Is.EqualTo(model.Draft));
        }
示例#4
0
        public void DeleteSingle(int Id)
        {
            NbkDbEntities     dbcontext = new NbkDbEntities();
            ChecklistTemplate Obj       = dbcontext.ChecklistTemplate.Where(x => x.Id == Id).FirstOrDefault();

            dbcontext.ChecklistTemplate.Remove(Obj);
            dbcontext.SaveChanges();
        }
示例#5
0
        public void ProjectChecklistsOnUpdateCreate(int?ProjectId, List <ProjectServiceENT> ServicesList)
        {
            NbkDbEntities db = new NbkDbEntities();
            List <int>    ProjectServiceIDs = ServicesList.Select(X => X.Id).ToList();

            //var list = (from r in db.ProjectChecklist where r.ProjectId == ProjectId select r).ToList();
            if (ProjectId != null)
            {
                var listServices = ListOfProjectServicesForUpdate(Convert.ToInt32(ProjectId), ProjectServiceIDs);
                foreach (var item in listServices)
                {
                    ChecklistTemplate ObjChecklistTemp = ChecklistTempByServiceID(item.ServiceId);
                    Service           ObjService       = ServiceByServiceID(item.ServiceId);
                    int totalServices = Convert.ToInt32(item.Quantity);
                    //int a = i + 1;
                    if (totalServices > 0)
                    {
                        for (int i = 0; i < totalServices; i++)
                        {
                            //Checklist for ServiceNameHere
                            ProjectChecklist obj = new ProjectChecklist();

                            obj.ProjectId = item.ProjectId;
                            if (item.Service.ChecklistTempId != null)
                            {
                                obj.ChecklistName = ObjChecklistTemp.Title;
                            }
                            else
                            {
                                obj.ChecklistName = "Checklist for " + ObjService.Name;
                            }
                            db.ProjectChecklist.Add(obj);
                            db.SaveChanges();
                            if (ObjService.ChecklistTempId != null)
                            {
                                int ProjectChecklistID = obj.Id;
                                int ChecklistTempId    = Convert.ToInt32(ObjService.ChecklistTempId);
                                SaveChecklistTemp(ChecklistTempId, ProjectChecklistID);
                            }
                        }
                    }
                    else
                    {
                        ProjectChecklist obj = new ProjectChecklist();
                        obj.ProjectId     = item.ProjectId;
                        obj.SortOrder     = item.Id;
                        obj.ChecklistName = item.Service.Name + " Checklist";
                        db.ProjectChecklist.Add(obj);
                        db.SaveChanges();
                    }
                    //Service status change
                    var ProService = db.ProjectService.Where(x => x.Id == item.Id).FirstOrDefault();
                    ProService.IsNewAdded = false;
                    db.SaveChanges();
                }
            }
        }
示例#6
0
        public ChecklistTemplate ChecklistTempByServiceID(int?serviceID)
        {
            NbkDbEntities dbcontext  = new NbkDbEntities();
            Service       ObjService = dbcontext.Service.Where(x => x.Id == serviceID).FirstOrDefault();

            if (ObjService.ChecklistTempId != null)
            {
                return(dbcontext.ChecklistTemplate.Where(x => x.Id == ObjService.ChecklistTempId).FirstOrDefault());
            }
            else
            {
                ChecklistTemplate obj = new ChecklistTemplate();
                return(obj);
            }
        }
示例#7
0
        public ChecklistTemplateENT CreateSingle(ChecklistTemplateENT Obj)
        {
            NbkDbEntities     dbcontext = new NbkDbEntities();
            ChecklistTemplate Data      = new ChecklistTemplate()
            {
                Title     = Obj.Title,
                IsDefault = Obj.IsDefault
            };

            dbcontext.ChecklistTemplate.Add(Data);
            dbcontext.SaveChanges();
            Obj.Id = Data.Id;


            if (Convert.ToInt32(Obj.ServiceSelectedID) > 0)
            {
                dbcontext = new NbkDbEntities();
                var ServiceDetail = dbcontext.Service.Where(x => x.Id == Obj.ServiceSelectedID).FirstOrDefault();
                ServiceDetail.ChecklistTempId = Obj.Id;
                dbcontext.SaveChanges();

                dbcontext = new NbkDbEntities();
                var PreviousService = dbcontext.Service.Where(x => x.ChecklistTempId == Obj.Id && x.Id != Obj.ServiceSelectedID).FirstOrDefault();
                if (PreviousService != null)
                {
                    PreviousService.ChecklistTempId = null;
                    dbcontext.SaveChanges();
                }
            }

            if (Obj.ChecklistItemTemplateList.Count > 0)
            {
                foreach (var item in Obj.ChecklistItemTemplateList)
                {
                    dbcontext = new NbkDbEntities();
                    ChecklistItemTemplate DataItems = new ChecklistItemTemplate()
                    {
                        Title       = item.Title,
                        ChecklistId = item.ChecklistId
                    };
                    dbcontext.ChecklistItemTemplate.Add(DataItems);
                    dbcontext.SaveChanges();
                    item.Id = DataItems.Id;
                }
            }

            return(Obj);
        }
示例#8
0
        public ChecklistTemplateENT SelectSingle(int Id)
        {
            NbkDbEntities                dbcontext = new NbkDbEntities();
            ChecklistTemplate            Obj       = dbcontext.ChecklistTemplate.Where(x => x.Id == Id).FirstOrDefault();
            List <ChecklistItemTemplate> ChecklistItemTemplateList = dbcontext.ChecklistItemTemplate.Where(x => x.ChecklistId == Obj.Id).ToList();

            if (ChecklistItemTemplateList == null)
            {
                ChecklistItemTemplateList.Add(new ChecklistItemTemplate());
            }
            Service CheckListAttchedWithService = dbcontext.Service.Where(x => x.ChecklistTempId == Obj.Id).FirstOrDefault();

            if (CheckListAttchedWithService == null)
            {
                CheckListAttchedWithService = new Service();
            }
            ChecklistTemplateENT Data = new ChecklistTemplateENT()
            {
                Id        = Obj.Id,
                Title     = Obj.Title,
                IsDefault = Obj.IsDefault,
                ChecklistItemTemplateList = new List <ChecklistItemTemplateENT>
                                            (
                    ChecklistItemTemplateList.Select(j => new ChecklistItemTemplateENT
                {
                    Id          = j.Id,
                    ChecklistId = j.ChecklistId,
                    Title       = j.Title
                })
                                            ),
                CheckListAttchedWithService = new ServiceItemTemplateENT()
                {
                    Id = CheckListAttchedWithService.Id,
                    ChecklistTempId  = CheckListAttchedWithService.ChecklistTempId,
                    Description      = CheckListAttchedWithService.Description,
                    Name             = CheckListAttchedWithService.Name,
                    Rate             = CheckListAttchedWithService.Rate,
                    ServiceChargedAs = CheckListAttchedWithService.ServiceChargedAs,
                    ServiceTypeId    = CheckListAttchedWithService.ServiceTypeId
                }
            };

            return(Data);
        }
        public void Given_existing_template_when_clone_with_name_then_new_template_is_saved()
        {
            // given
            var existingTempate = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1" };
            var newTemplateName = "ChecklistTemplate 2";

            _checklistTemplateRepository
                .Setup(x => x.GetById(existingTempate.Id))
                .Returns(() => existingTempate);

            ChecklistTemplate template1 = null;

            _checklistTemplateRepository
                .Setup(x => x.SaveOrUpdate(It.IsAny<ChecklistTemplate>()))
                                .Callback(
                    delegate(ChecklistTemplate x)
                    {
                        template1 = x;
                    }
                );

            // when
            var controller = GetTarget();
            controller.Clone(new CloneTemplateRequest { Id = existingTempate.Id, TemplateType = 1, Name = newTemplateName });

            //then
            _checklistTemplateRepository.Verify(x => x.SaveOrUpdate(template1), Times.Once);
        }
        public void Given_template_had_question_when_adding_same_question_to_template_then_the_question_is_not_duplicated()
        {
            // given
            var questionId = Guid.NewGuid();
            var template = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1"  };
            template.Questions.Add(new ChecklistTemplateQuestion() {Question = new Question() { Id = questionId }});

            _checklistTemplateRepository
                .Setup(x => x.GetById(It.IsAny<Guid>()))
                .Returns(() => template);

            _questionRepository.
               Setup(x => x.GetById(It.IsAny<Guid>()))
               .Returns<Guid>(id => new Question() { Id = id });

            ChecklistTemplate savedTemplate = null;
            _checklistTemplateRepository
               .Setup(x => x.SaveOrUpdate(It.IsAny<ChecklistTemplate>()))
                               .Callback(
                   delegate(ChecklistTemplate x)
                   {
                       savedTemplate = x;
                   }
               );

            // when
            var controller = GetTarget();
            var result = controller.UpdateTemplateQuestion(new UpdateTemplateQuestionRequest() {Exclude = false,QuestionId = questionId, TemplateId = template.Id});

            //then
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            Assert.That(savedTemplate.Questions.Count,Is.EqualTo(1));
        }
        public void Given_existing_template_with_same_name_when_rename_then_result_returns_forbidden()
        {
            // given
            var existingTempate = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1" };
            var newTemplateName = "ChecklistTemplate 2";

            _checklistTemplateRepository
                .Setup(x => x.GetById(existingTempate.Id))
                .Returns(() => existingTempate);

            _checklistTemplateRepository
                .Setup(x => x.DoesChecklistTemplateExistWithTheSameName(newTemplateName, existingTempate.Id)).Returns(
                    true);

            ChecklistTemplate template1 = null;

            _checklistTemplateRepository
                .Setup(x => x.SaveOrUpdate(It.IsAny<ChecklistTemplate>()))
                                .Callback(
                    delegate(ChecklistTemplate x)
                    {
                        template1 = x;
                    }
                );

            // when
            var controller = GetTarget();
            var result = controller.Rename(new RenameTemplateRequest { Id = existingTempate.Id, Name = newTemplateName });

            //then
            Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.Forbidden));
        }
        public void Given_existing_template_with_question_when_exclude_question_then_template_does_not_contains_question()
        {
            // given
            var checklistTemplateId = Guid.NewGuid();
            var existingTemplate = new ChecklistTemplate()
            {
                Id = checklistTemplateId,
                Name = "ChecklistTemplate 1"
            };

            existingTemplate.AddQuestion(
                new ChecklistTemplateQuestion
                {
                    ChecklistTemplate = new ChecklistTemplate() {Id = checklistTemplateId},
                    Question = new Question {Id = Guid.NewGuid(), Deleted = false}
                }
                , null);

            _checklistTemplateRepository
              .Setup(x => x.GetById(existingTemplate.Id))
              .Returns(() => existingTemplate);

            ChecklistTemplate savedTemplate = null;

            _checklistTemplateRepository
                .Setup(x => x.SaveOrUpdate(It.IsAny<ChecklistTemplate>()))
                .Callback(
                    delegate(ChecklistTemplate x)
                    {
                        savedTemplate = x;
                    }
                );

            // when
            var controller = GetTarget();
            controller.UpdateTemplateQuestion(new UpdateTemplateQuestionRequest()
            {
                TemplateId = existingTemplate.Id,
                QuestionId = existingTemplate.Questions[0].Question.Id,
                Exclude = true
            });

            //then
            Assert.That(savedTemplate.Questions.Count, Is.EqualTo(0));
        }
        public void Given_existing_template_with_question_when_clone_with_name_then_new_template_contains_questions()
        {
            // given
            var existingTempate = new ChecklistTemplate()
            {
                Id = Guid.NewGuid(),
                Name = "ChecklistTemplate 1"
            };

            existingTempate.AddQuestion(new ChecklistTemplateQuestion {Question = new Question {Id = Guid.NewGuid()}}, null);
            existingTempate.AddQuestion(new ChecklistTemplateQuestion { Question = new Question { Id = Guid.NewGuid() } }, null);

            var newTemplateName = "ChecklistTemplate 2";

            _checklistTemplateRepository
                .Setup(x => x.GetById(existingTempate.Id))
                .Returns(() => existingTempate);

            ChecklistTemplate template1 = null;

            _checklistTemplateRepository
                .Setup(x => x.SaveOrUpdate(It.IsAny<ChecklistTemplate>()))
                .Callback(
                    delegate(ChecklistTemplate x)
                    {
                        template1 = x;
                    }
                );

            // when
            var controller = GetTarget();
            controller.Clone(new CloneTemplateRequest
            {
                Id = existingTempate.Id,
                TemplateType = 2,
                Name = newTemplateName
            });

            //then
            Assert.That(template1.Questions.Count, Is.EqualTo(existingTempate.Questions.Count));
            Assert.That(template1.Questions[0].Question.Id, Is.EqualTo(existingTempate.Questions[0].Question.Id));
            Assert.That(template1.Questions[1].Question.Id, Is.EqualTo(existingTempate.Questions[1].Question.Id));
            Assert.That(template1.TemplateType, Is.EqualTo(ChecklistTemplateType.Bespoke));
        }
示例#14
0
        public void ProjectChecklistsCreate(int?ProjectId)
        {
            NbkDbEntities db = new NbkDbEntities();

            //var list = (from r in db.ProjectChecklist where r.ProjectId == ProjectId select r).ToList();

            if (ProjectId != null)
            {
                var listServices = ListOfProjectServices(Convert.ToInt32(ProjectId));
                foreach (var item in listServices)
                {
                    ChecklistTemplate ObjChecklistTemp = ChecklistTempByServiceID(item.ServiceId);
                    Service           ObjService       = ServiceByServiceID(item.ServiceId);
                    int totalServices = Convert.ToInt32(item.Quantity);
                    //int a = i + 1;
                    if (totalServices > 0)
                    {
                        for (int i = 0; i < totalServices; i++)
                        {
                            //Checklist for ServiceNameHere
                            ProjectChecklist obj = new ProjectChecklist();

                            obj.ProjectId = item.ProjectId;
                            if (ObjChecklistTemp != null && !string.IsNullOrEmpty(ObjChecklistTemp.Title))
                            {
                                obj.ChecklistName = ObjChecklistTemp.Title;
                            }
                            else
                            {
                                obj.ChecklistName = "Checklist for " + ObjService.Name;
                            }
                            db.ProjectChecklist.Add(obj);
                            db.SaveChanges();
                            if (ObjService.ChecklistTempId != null)
                            {
                                if (ObjService.ChecklistTempId > 0)
                                {
                                    int ProjectChecklistID = obj.Id;
                                    if (ObjChecklistTemp != null)
                                    {
                                        int ChecklistTempId = Convert.ToInt32(ObjService.ChecklistTempId);
                                        SaveChecklistTemp(ChecklistTempId, ProjectChecklistID);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        ProjectChecklist obj = new ProjectChecklist();
                        obj.ProjectId     = item.ProjectId;
                        obj.SortOrder     = item.Id;
                        obj.ChecklistName = item.Service.Name + " Checklist";
                        db.ProjectChecklist.Add(obj);
                        db.SaveChanges();
                    }
                    //Service status change
                    var ProService = db.ProjectService.Where(x => x.Id == item.Id).FirstOrDefault();
                    ProService.IsNewAdded = false;
                    db.SaveChanges();
                }
            }
            //if (list.Count != 0)
            //{
            //    //Service added new into project
            //    var listServices = new ProjectServicesModel().ListOfProjectServicesAddedNew(Convert.ToInt32(id));
            //    foreach (var item in listServices)
            //    {
            //        int totalServices = Convert.ToInt32(item.Quantity);
            //        //int a = i + 1;
            //        if (totalServices > 0)
            //        {
            //            for (int i = 0; i < totalServices; i++)
            //            {
            //                //Checklist for ServiceNameHere
            //                ProjectChecklist obj = new ProjectChecklist();
            //                obj.ProjectId = item.ProjectID;
            //                obj.SortOrder = item.ID;
            //                if (item.Service.ChecklistTempID != null)
            //                {
            //                    obj.ChecklistName = item.Service.ChecklistTemplate.Title;
            //                }
            //                else
            //                {
            //                    obj.ChecklistName = "Checklist for " + item.Service.Name;
            //                }
            //                db.ProjectChecklists.Add(obj);
            //                db.SaveChanges();
            //                if (item.Service.ChecklistTempID != null)
            //                {
            //                    int cheklistIdP = obj.Id;
            //                    int ChecklistTempId = Convert.ToInt32(item.Service.ChecklistTempID);
            //                    new NBKProject.Controllers.ChecklistController().SaveChecklistTemp(ChecklistTempId, cheklistIdP);
            //                }
            //            }
            //        }
            //        else
            //        {

            //            ProjectChecklist obj = new ProjectChecklist();
            //            obj.ProjectId = item.ProjectID;
            //            obj.SortOrder = item.ID;
            //            obj.ChecklistName = item.Service.Name + " Checklist";
            //           // db.ProjectChecklists.Add(obj);
            //           // db.SaveChanges();
            //        }
            //        //Service status change
            //       // var ProService = db.ProjectServices.Where(x => x.ID == item.ID).FirstOrDefault();
            //       // ProService.IsNewAdded = false;
            //       // db.SaveChanges();
            //    }
            //    //End service added new code
            //    //list = (from r in db.ProjectChecklists where r.ProjectId == id select r).ToList();
            //}
        }
        public void Given_question_When_get_question_industries_is_called_Then_List_industries_containing_the_question_is_returned()
        {
            var questionList = new List<Question>();

            var industry1 = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1"};
            var industry2 = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 2" };
            var industry3 = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 3" };

            var returnedIndustries = new List<ChecklistTemplateQuestion>();

            Question q = new Question() {Title = "Q1"};

            returnedIndustries.Add( new ChecklistTemplateQuestion() { Id = Guid.NewGuid(), Question = q, ChecklistTemplate = industry1 } );
            returnedIndustries.Add( new ChecklistTemplateQuestion() { Id = Guid.NewGuid(), Question = q, ChecklistTemplate = industry3 });

            _ChecklistTemplateQuestionRepository
                .Setup(x => x.GetByQuestion(It.IsAny<Guid>()))
                .Returns(returnedIndustries);

            //_ChecklistTemplateQuestionRepository
            //    .Setup(x => x.MarkForDelete(It.IsAny<Guid>()))
            //    .Returns(returnedIndustries);

            var controller = GetTarget();
            controller.GetIndustriesByQuestionId(Guid.NewGuid());

            Assert.That(returnedIndustries.Count, Is.EqualTo(2));
            Assert.That(returnedIndustries[0].Question.Title, Is.EqualTo("Q1"));
            Assert.That(returnedIndustries[1].Question.Title, Is.EqualTo("Q1"));

            Assert.That(returnedIndustries[0].ChecklistTemplate.Id, Is.EqualTo(industry1.Id));
            Assert.That(returnedIndustries[1].ChecklistTemplate.Id, Is.EqualTo(industry3.Id));
        }
        public void Given_question_details_and_existing_industry_When_post_question_is_called_then_question_is_added_to_industry()
        {
            var industry1 = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 1" };
            var industry2 = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 2" };
            var industry3 = new ChecklistTemplate() { Id = Guid.NewGuid(), Name = "ChecklistTemplate 3" };

            _industryRepository
                  .Setup(x => x.GetById(industry1.Id))
                  .Returns(() => industry1);

            _industryRepository
                  .Setup(x => x.GetById(industry2.Id))
                  .Returns(() => industry2);

            _industryRepository
                  .Setup(x => x.GetById(industry3.Id))
                  .Returns(() => industry3);

            var returnedIndustries = new List<ChecklistTemplateQuestion>();

            Question q = new Question() { Title = "Q1" };

            ChecklistTemplateQuestion iq1 = new ChecklistTemplateQuestion() {Id = Guid.NewGuid(), Question = q, ChecklistTemplate = industry1};
            ChecklistTemplateQuestion iq2 = new ChecklistTemplateQuestion() {Id = Guid.NewGuid(), Question = q, ChecklistTemplate = industry3};
            returnedIndustries.Add( iq1 );
            returnedIndustries.Add( iq2 );

            _ChecklistTemplateQuestionRepository
                .Setup(x => x.GetByQuestion(It.IsAny<Guid>()))
                .Returns(returnedIndustries);

            ChecklistTemplateQuestion indQuest1 = null;
            ChecklistTemplateQuestion indQuest2 = null;
            _ChecklistTemplateQuestionRepository
                .Setup(x => x.SaveOrUpdate( iq1))
                .Callback(
                    delegate(ChecklistTemplateQuestion x)
                    {
                        indQuest1 = x;
                    }
                );

            _ChecklistTemplateQuestionRepository
                .Setup(x => x.SaveOrUpdate(iq2))
                .Callback(
                    delegate(ChecklistTemplateQuestion x)
                    {
                        indQuest2 = x;
                    }
                );

            _questionRepository
               .Setup(x => x.GetById(It.IsAny<Guid>()))
               .Returns(q);

            var industryModel = new IndustryQuestionModel();
            industryModel.QuestionId = q.Id;
            industryModel.IndustryIds = new List<Guid>();
            industryModel.IndustryIds.Add( industry2.Id);

            var controller = GetTarget();
            controller.UpdateIndustryQuestions(industryModel);

            Assert.IsTrue(indQuest1.Deleted);
            Assert.IsTrue(indQuest2.Deleted);

            _ChecklistTemplateQuestionRepository.Verify(x => x.SaveOrUpdate(iq1), Times.Once);
            _ChecklistTemplateQuestionRepository.Verify(x => x.SaveOrUpdate(iq2), Times.Once);
        }