private void InitializationResponseSetViewModel(ResponseSetsType type, string propertyName)
        {
            bool isTestCompleteCalled = false;
            ResponseSetsViewModel responseSet = new ResponseSetsViewModel(type);
            responseSet.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == propertyName)
                {
                    Assert.AreEqual(ResponseSetsViewModel.TOP_COUNT, responseSet.TopResponses.Count);                    
                    if (type == ResponseSetsType.Submitted)
                    {
                        var submitted = responseSet.DisplayedResponses.Where(item => item.IsSubmitted == true);
                        Assert.AreEqual(responseSet.DisplayedResponses.Count, submitted.Count());
                    }
                    else
                    {
                        Assert.AreEqual(RESPONSE_SETS_COUNT - RESPONSE_SETS_COUNT / 4, responseSet.DisplayedResponses.Count);
                    }

                    CallTestComplete(ref isTestCompleteCalled);
                }
            };

            responseSet.InitializeViewModelCommand.Execute(null);
            EndOnWaitingResponse();
        }
 public void CreationTest()
 {
     ResponseSetsViewModel savedViewModel = new ResponseSetsViewModel(ResponseSetsType.Saved);
     Assert.IsFalse(savedViewModel.IsBusy);
     Assert.IsTrue(savedViewModel.DeleteResponseSetCommand.CanExecute(null));
     Assert.IsTrue(savedViewModel.InitializeViewModelCommand.CanExecute(null));
     Assert.AreEqual(string.Empty, savedViewModel.SearchString);
 }
        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;
        }
Ejemplo n.º 4
0
 private static void ClearSubmittedResponses()
 {
     submittedResponsesStatic = null;
 }
Ejemplo n.º 5
0
 private static void ClearSavedResponses()
 {
     savedResponsesStatic = null;
 }
Ejemplo n.º 6
0
 private static void ClearSubmittedResponses()
 {
     submittedResponsesStatic = null;
 }
Ejemplo n.º 7
0
 private static void ClearSavedResponses()
 {
     savedResponsesStatic = null;
 }