public void InstallSurvey(string instrumentName, string serverParkName, string instrumentFile,
                           SurveyInterviewType surveyInterviewType)
 {
     NameOfInstalledSurvey       = instrumentName;
     ServerParkOfInstalledSurvey = serverParkName;
     SurveyInstalled             = true;
     SurveyStatus = SurveyStatusType.Active;
 }
        public void InstallInstrument(ConnectionModel connectionModel, string instrumentName, string serverParkName,
                                      string instrumentFile, SurveyInterviewType surveyInterviewType)
        {
            var serverPark = _parkService.GetServerPark(connectionModel, serverParkName);

            serverPark.InstallSurvey(instrumentFile,
                                     surveyInterviewType.FullName(),
                                     SurveyDataEntryType.StrictInterviewing.ToString(),
                                     DataOverwriteMode.Always);
        }
        public void InstallSurvey(string instrumentName, string serverParkName,
                                  string instrumentFile, SurveyInterviewType surveyInterviewType)
        {
            instrumentName.ThrowExceptionIfNullOrEmpty("instrumentName");
            serverParkName.ThrowExceptionIfNullOrEmpty("serverParkName");
            instrumentFile.ThrowExceptionIfNullOrEmpty("instrumentFile");

            _surveyService.InstallInstrument(_connectionModel, instrumentName, serverParkName,
                                             instrumentFile, surveyInterviewType);
        }
Example #4
0
        public void Given_Survey_Exists_When_I_Call_GetSurveyInterviewType_Then_The_Correct_SurveyInterviewType_Is_Returned(
            string interviewType, SurveyInterviewType surveyInterviewType)
        {
            //arrange
            const string instrumentName = "Instrument1";
            var          surveyMock     = new Mock <ISurvey>();

            surveyMock.Setup(s => s.Name).Returns(instrumentName);

            var surveyItems = new List <ISurvey> {
                surveyMock.Object
            };

            _surveyCollectionMock = new Mock <ISurveyCollection>();
            _surveyCollectionMock.Setup(s => s.GetEnumerator()).Returns(() => surveyItems.GetEnumerator());
            _serverParkMock.Setup(s => s.Surveys).Returns(_surveyCollectionMock.Object);

            var iConfigurationMock = new Mock <IConfiguration>();

            iConfigurationMock.Setup(c => c.InitialLayoutSetGroupName).Returns(interviewType);
            iConfigurationMock.Setup(c => c.InstrumentName).Returns(instrumentName);
            var configurations = new List <IConfiguration> {
                iConfigurationMock.Object
            };

            var machineConfigurationMock = new Mock <IMachineConfigurationCollection>();

            machineConfigurationMock.Setup(m => m.Configurations).Returns(configurations);
            surveyMock.Setup(s => s.Configuration).Returns(machineConfigurationMock.Object);

            //act
            var result = _sut.GetSurveyInterviewType(_connectionModel, instrumentName, _serverParkName);

            //assert
            Assert.AreEqual(surveyInterviewType, result);
        }
        public void Given_Valid_Arguments_When_I_Call_GetSurveyInterviewType_Then_The_Expected_Result_Is_Returned(SurveyInterviewType surveyInterviewType)
        {
            //arrange
            _surveyServiceMock.Setup(p => p.GetSurveyInterviewType(_connectionModel, _instrumentName, _serverParkName)).Returns(surveyInterviewType);

            //act
            var result = _sut.GetSurveyInterviewType(_instrumentName, _serverParkName);

            //assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOf <SurveyInterviewType>(result);
            Assert.AreEqual(surveyInterviewType, result);
        }
        public void Given_Valid_Arguments_When_I_Call_InstallSurvey_Then_The_Correct_Service_Method_Is_Called(SurveyInterviewType surveyInterviewType)
        {
            //arrange
            const string instrumentFile = @"d:\\opn2101a.pkg";

            //act
            _sut.InstallSurvey(_instrumentName, _serverParkName, instrumentFile, surveyInterviewType);

            //assert
            _surveyServiceMock.Verify(v => v.InstallInstrument(_connectionModel, _instrumentName,
                                                               _serverParkName, instrumentFile, surveyInterviewType), Times.Once);
        }