public void Execute(IGetServerStatusRequest request, Action<IGetServerStatusResponse> responseBoundary)
        {
            if (request == null)
                throw new ArgumentNullException("request", "Use case request cannot be null!");
            if (responseBoundary == null)
                throw new ArgumentNullException("responseBoundary", "Response handler cannot be null!");

            try
            {
                var response = restClient.GetServerStatus();

                var isOnline = response.Code == HttpStatusCode.OK;

                responseBoundary(new GetServerStatusResponse(isOnline));
            }
            catch (Exception ex)
            {
                throw new UseCaseExecutionException("An error occurred while trying to get Server Status!", ex);
            }
        }
Exemple #2
0
        public void Execute(IGetServerStatusRequest request, Action <IGetServerStatusResponse> responseBoundary)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request", "Use case request cannot be null!");
            }
            if (responseBoundary == null)
            {
                throw new ArgumentNullException("responseBoundary", "Response handler cannot be null!");
            }

            try
            {
                var response = restClient.GetServerStatus();

                var isOnline = response.Code == HttpStatusCode.OK;

                responseBoundary(new GetServerStatusResponse(isOnline));
            }
            catch (Exception ex)
            {
                throw new UseCaseExecutionException("An error occurred while trying to get Server Status!", ex);
            }
        }