Dev2.Services.ServerServiceConfiguration.PromptUserToStartService C# (CSharp) Method

PromptUserToStartService() public method

public PromptUserToStartService ( ) : bool
return bool
        public bool PromptUserToStartService()
        {
            if(ServiceManager == null)
            {
                throw new Exception("Null Service Manager");
            }

            if(!IsServiceRunning())
            {
                if(PopupController == null)
                {
                    throw new Exception("Null Popup Controller");
                }

                var startResult = PopupController.Show("The Warewolf service isn't running would you like to start it?", "Service not Running", MessageBoxButton.YesNo, MessageBoxImage.Question, null);

                if(startResult == MessageBoxResult.None || startResult == MessageBoxResult.No || startResult == MessageBoxResult.Cancel)
                {
                    return false;
                }

                return true;
            }

            return false;
        }

Usage Example

        public void ServerServiceConfiguration_PromptUserToStartService_WhenNullServiceConfiguration_ExpectException()
        {
            //------------Setup for test--------------------------
            var serverServiceConfiguration = new ServerServiceConfiguration(null);

            //------------Execute Test---------------------------
            serverServiceConfiguration.PromptUserToStartService();

        }