Esempio n. 1
0
 /// <summary>
 /// Logout.
 /// </summary>
 public ResponseDTO <object> Logout()
 {
     this.LoggedUser           = null;
     this.CurrentSession       = null;
     this.SelectedQuestionsSet = null;
     return(ResponseDTO.Ok("Successfully logged out."));
 }
Esempio n. 2
0
        public SettingsDialog(TriviaApp pTriviaApp)
        {
            this.Build();
            this._triviaApp = pTriviaApp;

            _selectedQuestionsSetBackUp     = this._triviaApp.SelectedQuestionsSet;
            this.lblQuestionSetName.Text    = this._triviaApp.SelectedQuestionsSet.Name;
            this.entExpectedAnswerTime.Text = this._triviaApp.SelectedQuestionsSet.ExpectedAnswerTime.ToString();
        }
 /// <summary>
 /// Save the specified pQuestionsSet.
 /// </summary>
 /// <param name="pQuestionsSet">Questions set DTO.</param>
 public ResponseDTO <object> SaveQuestionsSet(QuestionsSetDTO pQuestionsSet)
 {
     try
     {
         QuestionsSet modifiedQuestionsSet = _mapper.Map <QuestionsSet>(pQuestionsSet);
         return(_questionsSetService.Save(modifiedQuestionsSet));
     }
     catch (Exception ex)
     {
         _logger.Error(ex, $"Failed to save QuestionsSet. {ex.Message}");
         return(ResponseDTO.InternalError(ErrorMessageHelper.FailedOperation("saving questions set")));
     }
 }
        public void SaveQuestionsSetShouldReturnOk()
        {
            _questionSetServiceMock.Setup(service => service.Save(It.IsAny <QuestionsSet>())).Returns(ResponseDTO.Ok(""));

            QuestionsSetDTO questionsSetDTO = new QuestionsSetDTO
            {
                Id   = 1,
                Name = "abcdefg_1234"
            };

            var response = _backOfficeServices.SaveQuestionsSet(questionsSetDTO);

            Assert.IsTrue(response.Success);
            Assert.AreEqual(ResponseCode.Ok, response.Code);
        }