Exemple #1
0
        public void SearchLocationCommand_ServiceReternExceptionWithServerErrorResponseModel_ReternErrorMessage(string message, string code)
        {
            //Arrange
            var serverErrorResponse = new ServerErrorResponseModel
            {
                Message = message,
                Code    = code
            };

            string space = " ";

            _locationSearchServiceMoc
            .Setup(service => service.GetLocationListByTextAsync(It.IsAny <string>()))
            .ThrowsAsync(new ApiException(serverErrorResponse));

            var searchLocationListViewModel = new SearchLocationListViewModel(_locationSearchServiceMoc.Object);

            //Act
            searchLocationListViewModel.SearchLocationCommand.Execute(null);

            //Assert
            Assert.AreEqual($"{serverErrorResponse.Code}{space}{serverErrorResponse.Message}", searchLocationListViewModel.ErrorMessage);
            Assert.IsTrue(searchLocationListViewModel.IsErrorMessageVisible);
            Assert.IsFalse(searchLocationListViewModel.IsListVisible);
        }
Exemple #2
0
 public ApiException(ServerErrorResponseModel serverErrorResponse)
 {
     ServerErrorResponse = serverErrorResponse;
 }