Beispiel #1
0
        public static ResponseSet GenerateAndSaveResponseSet(ResponseSetType type, Survey survey)
        {
            var responseSet = GenerateResponseSet(type, survey);

            repository.AddResponseSetToDB(responseSet);
            return(responseSet);
        }
Beispiel #2
0
        public static ResponseSet GenerateResponseSet(ResponseSetType type, Survey survey)
        {
            ResponseSet set = new ResponseSet();

            set.ID       = rand.Next(0, 1000);
            set.SurveyID = survey.ID;
            set.SystemID = LoginViewModelTest.SERVER_PATH;
            set.Name     = rand.Next(0, 1000).ToString();
            switch (type)
            {
            case ResponseSetType.Completed:
                set.IsCompleted = true;
                break;

            case ResponseSetType.InProgress:
                set.IsCompleted = false;
                set.IsSubmitted = false;
                break;

            case ResponseSetType.Submitted:
                set.IsSubmitted = true;
                break;

            default:
                break;
            }

            set.UserID = Membership.CurrentUser.ID;
            return(set);
        }
        public static ResponseSet GenerateResponseSet(ResponseSetType type, Survey survey)
        {
            ResponseSet set = new ResponseSet();
            set.ID = rand.Next(0, 1000);
            set.SurveyID = survey.ID;
            set.SystemID = LoginViewModelTest.SERVER_PATH;
            set.Name = rand.Next(0, 1000).ToString();
            switch (type)
            {
                case ResponseSetType.Completed:
                    set.IsCompleted = true;
                    break;
                case ResponseSetType.InProgress:
                    set.IsCompleted = false;
                    set.IsSubmitted = false;
                    break;
                case ResponseSetType.Submitted:
                    set.IsSubmitted = true;
                    break;
                default:
                    break;
            }

            set.UserID = Membership.CurrentUser.ID;
            return set;
        }
Beispiel #4
0
        public static List <ResponseSet> GenerateResponseSets(ResponseSetType type, int count)
        {
            List <ResponseSet> result = new List <ResponseSet>();
            Survey             survey = GenerateSurvey(rand.Next(0, 1000));

            surveyRepository.AddNewSurveyForUser(survey, Membership.CurrentUser.ID);
            while (count > 0)
            {
                var set = GenerateResponseSet(type, survey);
                result.Add(set);
                repository.AddResponseSetToDB(set);
                count--;
            }

            return(result);
        }
        private bool DeleteResponseSet(ResponseSetsType viewModelType, ResponseSetType responseType)
        {
            SurveyMock.RemoveAllSurveys();
            bool isCompleted = false;
            var  survey      = SurveyMock.GenerateAndSaveSurvey(SURVEY_ID);
            var  responseSet = SurveyMock.GenerateAndSaveResponseSet(responseType, survey);
            ResponseSetsViewModel viewModel = new ResponseSetsViewModel(viewModelType);

            viewModel.TestCompleted += (sender, args) =>
            {
                if (args.Message == RESPONSE_DELETED)
                {
                    Assert.AreEqual(0, viewModel.DisplayedResponses.Count);
                    Assert.AreEqual(0, viewModel.TopResponses.Count);
                    isCompleted = true;
                }
            };

            viewModel.DeleteResponseSetCommand.Execute(responseSet);
            return(isCompleted);
        }
        private bool DeleteResponseSet(ResponseSetsType viewModelType, ResponseSetType responseType)
        {
            SurveyMock.RemoveAllSurveys();
            bool isCompleted = false;
            var survey = SurveyMock.GenerateAndSaveSurvey(SURVEY_ID);
            var responseSet = SurveyMock.GenerateAndSaveResponseSet(responseType, survey);
            ResponseSetsViewModel viewModel = new ResponseSetsViewModel(viewModelType);
            viewModel.TestCompleted += (sender, args) =>
            {
                if (args.Message == RESPONSE_DELETED)
                {
                    Assert.AreEqual(0, viewModel.DisplayedResponses.Count);
                    Assert.AreEqual(0, viewModel.TopResponses.Count);
                    isCompleted = true;
                }
            };

            viewModel.DeleteResponseSetCommand.Execute(responseSet);
            return isCompleted;
        }
 public static ResponseSet GenerateAndSaveResponseSet(ResponseSetType type, Survey survey)
 {
     var responseSet = GenerateResponseSet(type, survey);
     repository.AddResponseSetToDB(responseSet);
     return responseSet;
 }
        public static List<ResponseSet> GenerateResponseSets(ResponseSetType type, int count)
        {
            List<ResponseSet> result = new List<ResponseSet>();
            Survey survey = GenerateSurvey(rand.Next(0, 1000));
            surveyRepository.AddNewSurveyForUser(survey, Membership.CurrentUser.ID);
            while (count > 0)
            {
                var set = GenerateResponseSet(type, survey);
                result.Add(set);
                repository.AddResponseSetToDB(set);
                count--;
            }

            return result;
        }