예제 #1
0
 public PubnubClientError(int statusCode, PubnubErrorSeverity errorSeverity, string message, PubnubMessageSource source, PubnubWebRequest pubnubWebRequest, PubnubWebResponse pubnubWebResponse, string description, string channel, string channelGroup)
 {
     _dateTimeGMT             = DateTime.Now.ToUniversalTime();
     _statusCode              = statusCode;
     _isDotNetException       = false;
     _message                 = message;
     _errorSeverity           = errorSeverity;
     _messageSource           = source;
     _channel                 = channel;
     _channel                 = channelGroup;
     _detailedDotNetException = null;
     _pubnubWebRequest        = pubnubWebRequest;
     _pubnubWebResponse       = pubnubWebResponse;
     _description             = description;
 }
예제 #2
0
        public string GetStubResponse(HttpWebRequest request)
        {
            Uri requestUri = request.RequestUri;

            Dictionary<string, string> responseDictionary = null;
            string stubResponse = "!! Stub Response Not Assigned !!";
            System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}", _testClassName, _testCaseName));
            switch (_testClassName)
            {
                case "GrantRequestUnitTest":
                    switch (_testCaseName)
                    {
                        case "Init":
                            responseDictionary = LoadGrantRequestUnitTestInit();
                            break;
                        case "Init2":
                            responseDictionary = LoadGrantRequestUnitTestInit2();
                            break;
                        case "Init3":
                            responseDictionary = LoadGrantRequestUnitTestInit3();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenAClientIsPresented":
                    switch (_testCaseName)
                    {
                        case "ThenPresenceShouldReturnReceivedMessage":
                            responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnReceivedMessage();
                            break;
                        case "ThenPresenceShouldReturnCustomUUID":
                            responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnCustomUUID();
                            break;
                        case "IfHereNowIsCalledThenItShouldReturnInfo":
                            responseDictionary = LoadWhenAClientIsPresentedIfHereNowIsCalledThenItShouldReturnInfo();
                            break;
                        case "IfGlobalHereNowIsCalledThenItShouldReturnInfo":
                            responseDictionary = LoadWhenAClientIsPresentedIfGlobalHereNowIsCalledThenItShouldReturnInfo();
                            break;
                        case "IfWhereNowIsCalledThenItShouldReturnInfo":
                            responseDictionary = LoadWhenAClientIsPresentedIfWhereNowIsCalledThenItShouldReturnInfo();
                            break;
                        case "IfHereNowIsCalledThenItShouldReturnInfoWithUserState":
                            responseDictionary = LoadWhenAClientIsPresentedIfHereNowIsCalledThenItShouldReturnInfoWithUserState();
                            break;
                        case "IfGlobalHereNowIsCalledThenItShouldReturnInfoWithUserState":
                            responseDictionary = LoadWhenAClientIsPresentedIfGlobalHereNowIsCalledThenItShouldReturnInfoWithUserState();
                            break;
                        case "IfSetAndGetUserStateThenItShouldReturnInfo":
                            responseDictionary = LoadWhenAClientIsPresentedIfSetAndGetUserStateThenItShouldReturnInfo();
                            break;
                        case "IfSetAndDeleteUserStateThenItShouldReturnInfo":
                            responseDictionary = LoadWhenAClientIsPresentedIfSetAndDeleteUserStateThenItShouldReturnInfo();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenAMessageIsPublished":
                    switch (_testCaseName)
                    {
                        case "ThenUnencryptPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenEncryptPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenEncryptPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenComplexMessageObjectShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenOptionalSecretKeyShouldBeProvidedInConstructor":
                            responseDictionary = LoadWhenAMessageIsPublishedThenOptionalSecretKeyShouldBeProvidedInConstructor();
                            break;
                        case "IfSSLNotProvidedThenDefaultShouldBeFalse":
                            responseDictionary = LoadWhenAMessageIsPublishedIfSSLNotProvidedThenDefaultShouldBeFalse();
                            break;
                        case "ThenDisableJsonEncodeShouldSendSerializedObjectMessage":
                            responseDictionary = LoadWhenAMessageIsPublishedThenDisableJsonEncodeShouldSendSerializedObjectMessage();
                            break;
                        case "ThenLargeMessageShoudFailWithMessageTooLargeInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenLargeMessageShoudFailWithMessageTooLargeInfo();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenDetailedHistoryIsRequested":
                    switch (_testCaseName)
                    {
                        case "DetailHistoryCount10ReturnsRecords":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReturnsRecords();
                            break;
                        case "DetailHistoryCount10ReverseTrueReturnsRecords":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReverseTrueReturnsRecords();
                            break;
                        case "DetailedHistoryStartWithReverseTrue":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryStartWithReverseTrue();
                            break;
                        case "DetailHistoryWithNullKeysReturnsError":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryWithNullKeysReturnsError();
                            break;
                        case "DetailHistoryNoStoreShouldNotGetMessage":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryNoStoreShouldNotGetMessage();
                            break;
                        case "DetailHistoryShouldReturnDecryptMessage":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryShouldReturnDecryptMessage();
                            break;
                        case "DetailHistoryShouldReturnServerTime1":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryShouldReturnServerTime1();
                            break;
                        case "DetailHistoryShouldReturnServerTime2":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryShouldReturnServerTime2();
                            break;
                        case "DetailHistoryShouldReturnServerTime3":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryShouldReturnServerTime3();
                            break;
                        case "DetailedHistoryShouldReturnEncryptedMessageBasedOnParams":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryShouldReturnEncryptedMessageBasedOnParams();
                            break;
                        case "DetailedHistoryShouldReturnUnencryptedMessageBasedOnParams":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryShouldReturnUnencryptedMessageBasedOnParams();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenGetRequestServerTime":
                    switch (_testCaseName)
                    {
                        case "ThenItShouldReturnTimeStamp":
                            responseDictionary = LoadWhenGetRequestServerTimeThenItShouldReturnTimeStamp();
                            break;
                        case "ThenWithProxyItShouldReturnTimeStamp":
                            responseDictionary = LoadWhenGetRequestServerTimeThenWithProxyItShouldReturnTimeStamp();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenSubscribedToAChannel":
                    switch (_testCaseName)
                    {
                        case "ThenSubscribeShouldReturnReceivedMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedMessage();
                            break;
                        case "ThenSubscribeShouldReturnReceivedCipherMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedCipherMessage();
                            break;
                        case "ThenSubscribeShouldReturnConnectStatus":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnConnectStatus();
                            break;
                        case "ThenMultiSubscribeShouldReturnConnectStatus":
                            responseDictionary = LoadWhenSubscribedToAChannelThenMultiSubscribeShouldReturnConnectStatus();
                            break;
                        case "ThenDuplicateChannelShouldReturnAlreadySubscribed":
                            responseDictionary = LoadWhenSubscribedToAChannelThenDuplicateChannelShouldReturnAlreadySubscribed();
                            break;
                        case "ThenSubscriberShouldBeAbleToReceiveManyMessages":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscriberShouldBeAbleToReceiveManyMessages();
                            break;
                        case "ThenSubscribeShouldReturnReceivedComplexMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedComplexMessage();
                            break;
                        case "ThenSubscribeShouldReturnReceivedCipherComplexMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedCipherComplexMessage();
                            break;
                        case "ThenSubscribeShouldReturnReceivedEmojiMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedEmojiMessage();
                            break;
                        case "ThenSubscribeShouldReturnReceivedCipherEmojiMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedCipherEmojiMessage();
                            break;
                        case "ThenSubscribeShouldReturnUnicodeMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnUnicodeMessage();
                            break;
                        case "ThenSubscribeShouldReturnUnicodeCipherMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnUnicodeCipherMessage();
                            break;
                        case "ThenSubscribeShouldReturnReceivedForwardSlashMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedForwardSlashMessage();
                            break;
                        case "ThenSubscribeShouldReturnReceivedForwardSlashCipherMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedForwardSlashCipherMessage();
                            break;
                        case "ThenSubscribeShouldReturnSpecialCharMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnSpecialCharMessage();
                            break;
                        case "ThenSubscribeShouldReturnSpecialCharCipherMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnSpecialCharCipherMessage();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenSubscribedToAChannelGroup":
                    switch (_testCaseName)
                    {
                        case "ThenSubscribeShouldReturnReceivedMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelGroupThenSubscribeShouldReturnReceivedMessage();
                            break;
                        case "ThenSubscribeShouldReturnConnectStatus":
                            responseDictionary = LoadWhenSubscribedToAChannelGroupThenSubscribeShouldReturnConnectStatus();
                            break;
                        case "ThenMultiSubscribeShouldReturnConnectStatus":
                            responseDictionary = LoadWhenSubscribedToAChannelGroupThenMultiSubscribeShouldReturnConnectStatus();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenUnsubscribedToAChannel":
                    switch (_testCaseName)
                    {
                        case "ThenShouldReturnUnsubscribedMessage":
                            responseDictionary = LoadWhenUnsubscribedToAChannelThenShouldReturnUnsubscribedMessage();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenUnsubscribedToAChannelGroup":
                    switch (_testCaseName)
                    {
                        case "ThenShouldReturnUnsubscribedMessage":
                            responseDictionary = LoadWhenUnsubscribedToAChannelGroupThenShouldReturnUnsubscribedMessage();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenAuditIsRequested":
                    switch (_testCaseName)
                    {
                        case "ThenSubKeyLevelShouldReturnSuccess":
                            responseDictionary = LoadWhenAuditIsRequestedThenSubKeyLevelShouldReturnSuccess();
                            break;
                        case "ThenChannelLevelShouldReturnSuccess":
                            responseDictionary = LoadWhenAuditIsRequestedThenChannelLevelShouldReturnSuccess();
                            break;
                        case "ThenChannelGroupLevelShouldReturnSuccess":
                            responseDictionary = LoadWhenAuditIsRequestedThenChannelGroupLevelShouldReturnSuccess();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenGrantIsRequested":
                    switch (_testCaseName)
                    {
                        case "ThenSubKeyLevelWithReadWriteShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenSubKeyLevelWithReadWriteShouldReturnSuccess();
                            break;
                        case "ThenSubKeyLevelWithReadShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenSubKeyLevelWithReadShouldReturnSuccess();
                            break;
                        case "ThenSubKeyLevelWithWriteShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenSubKeyLevelWithWriteShouldReturnSuccess();
                            break;
                        case "ThenChannelLevelWithReadWriteShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenChannelLevelWithReadWriteShouldReturnSuccess();
                            break;
                        case "ThenChannelLevelWithReadShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenChannelLevelWithReadShouldReturnSuccess();
                            break;
                        case "ThenChannelLevelWithWriteShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenChannelLevelWithWriteShouldReturnSuccess();
                            break;
                        case "ThenUserLevelWithReadWriteShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenUserLevelWithReadWriteShouldReturnSuccess();
                            break;
                        case "ThenUserLevelWithReadShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenUserLevelWithReadShouldReturnSuccess();
                            break;
                        case "ThenUserLevelWithWriteShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenUserLevelWithWriteShouldReturnSuccess();
                            break;
                        case "ThenMultipleChannelGrantShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenMultipleChannelGrantShouldReturnSuccess();
                            break;
                        case "ThenMultipleAuthGrantShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenMultipleAuthGrantShouldReturnSuccess();
                            break;
                        case "ThenRevokeAtSubKeyLevelReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenRevokeAtSubKeyLevelReturnSuccess();
                            break;
                        case "ThenRevokeAtChannelLevelReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenRevokeAtChannelLevelReturnSuccess();
                            break;
                        case "ThenRevokeAtUserLevelReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenRevokeAtUserLevelReturnSuccess();
                            break;
                        case "ThenChannelGroupLevelWithReadManageShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenChannelGroupLevelWithReadManageShouldReturnSuccess();
                            break;
                        case "ThenChannelGroupLevelWithReadShouldReturnSuccess":
                            responseDictionary = LoadWhenGrantIsRequestedThenChannelGroupLevelWithReadShouldReturnSuccess();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenPushIsRequested":
                    switch (_testCaseName)
                    {
                        case "ThenRegisterDeviceShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenRegisterDeviceShouldReturnSuccess();
                            break;
                        case "ThenUnregisterDeviceShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenUnregisterDeviceShouldReturnSuccess();
                            break;
                        case "ThenRemoveChannelForDeviceShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenRemoveChannelForDeviceShouldReturnSuccess();
                            break;
                        case "ThenGetAllChannelsForDeviceShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenGetAllChannelsForDeviceShouldReturnSuccess();
                            break;
                        case "ThenPublishMpnsToastShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenPublishMpnsToastShouldReturnSuccess();
                            break;
                        case "ThenPublishMpnsFlipTileShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenPublishMpnsFlipTileShouldReturnSuccess();
                            break;
                        case "ThenPublishMpnsCycleTileShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenPublishMpnsCycleTileShouldReturnSuccess();
                            break;
                        case "ThenPublishMpnsIconicTileShouldReturnSuccess":
                            responseDictionary = LoadWhenPushIsRequestedThenPublishMpnsIconicTileShouldReturnSuccess();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenChannelGroupIsRequested":
                    switch (_testCaseName)
                    {
                        case "ThenAddChannelShouldReturnSuccess":
                            responseDictionary = LoadWhenChannelGroupIsRequestedThenAddChannelShouldReturnSuccess();
                            break;
                        case "ThenRemoveChannelShouldReturnSuccess":
                            responseDictionary = LoadWhenChannelGroupIsRequestedThenRemoveChannelShouldReturnSuccess();
                            break;
                        case "ThenGetChannelListShouldReturnSuccess":
                            responseDictionary = LoadWhenChannelGroupIsRequestedThenGetChannelListShouldReturnSuccess();
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }

            if (responseDictionary != null && responseDictionary.ContainsKey(requestUri.AbsolutePath))
            {
                stubResponse = responseDictionary[requestUri.AbsolutePath];
                if (_testClassName == "WhenAMessageIsPublished" && _testCaseName == "ThenLargeMessageShoudFailWithMessageTooLargeInfo")
                {
                    PubnubWebResponse stubWebResponse = new PubnubWebResponse(new MemoryStream(Encoding.UTF8.GetBytes(stubResponse)), HttpStatusCode.BadRequest);
            #if (SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE)
                    WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.Pending, stubWebResponse);
            #else
                    WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.ProtocolError, stubWebResponse);
            #endif
                    throw largeMessageException;
                }
            }
            else if (responseDictionary != null)
            {
            #if (SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE)
                string uriKey = string.Format("{0}{1}",requestUri.AbsolutePath, requestUri.Query);
                if (responseDictionary.ContainsKey(uriKey))
                {
                    stubResponse = responseDictionary[uriKey];
                }
                else if (requestUri.Query.Contains("&pnsdk="))
                {
                    int indexOfPnsdk = requestUri.Query.IndexOf("&pnsdk=");
                    string modifiedQuery = requestUri.Query.Substring(0, indexOfPnsdk);
                    string uriModifiedKey = string.Format("{0}{1}",requestUri.AbsolutePath, modifiedQuery);
                    if (responseDictionary.ContainsKey(uriModifiedKey))
                    {
                        stubResponse = responseDictionary[uriModifiedKey];
                    }
                    else
                    {
                         stubResponse = "[]";
                    }
                }
            #else
                if (responseDictionary.ContainsKey(requestUri.PathAndQuery))
                {
                    stubResponse = responseDictionary[requestUri.PathAndQuery];
                }
                else if (requestUri.PathAndQuery.Contains("&pnsdk="))
                {
                    int indexOfPnsdk = requestUri.PathAndQuery.IndexOf("&pnsdk=");
                    string modifiedRequestUri = requestUri.PathAndQuery.Substring(0, indexOfPnsdk);
                    if (responseDictionary.ContainsKey(modifiedRequestUri))
                    {
                        stubResponse = responseDictionary[modifiedRequestUri];
                    }
                    else
                    {
                        stubResponse = "[]";
                    }
                }
            #endif
            }
            else
            {
                stubResponse = "[]";
            }
            if (stubResponse == "!! Stub Response Not Assigned !!" || stubResponse == "[]")
            {
                Console.WriteLine("requestUri.AbsolutePath = " + requestUri.AbsolutePath);
                Console.WriteLine("stubResponse = " + stubResponse);
                System.Diagnostics.Debug.WriteLine("requestUri.AbsolutePath = " + requestUri.AbsolutePath);
                System.Diagnostics.Debug.WriteLine("stubResponse = " + stubResponse);
            }
            return stubResponse;
        }
예제 #3
0
        public string GetStubResponse(HttpWebRequest request)
        {
            Uri requestUri = request.RequestUri;

            Dictionary<string, string> responseDictionary = null;
            string stubResponse = "!! Stub Response Not Assigned !!";
            System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}", _testClassName, _testCaseName));
            switch (_testClassName)
            {
                case "WhenAClientIsPresented":
                    switch (_testCaseName)
                    {
                        case "ThenPresenceShouldReturnReceivedMessage":
                            responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnReceivedMessage();
                            break;
                        case "ThenPresenceShouldReturnCustomUUID":
                            responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnCustomUUID();
                            break;
                        case "IfHereNowIsCalledThenItShouldReturnInfo":
                            responseDictionary = LoadWhenAClientIsPresentedIfHereNowIsCalledThenItShouldReturnInfo();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenAMessageIsPublished":
                    switch (_testCaseName)
                    {
                        case "ThenUnencryptPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenEncryptPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenEncryptPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenComplexMessageObjectShouldReturnSuccessCodeAndInfo();
                            break;
                        case "ThenOptionalSecretKeyShouldBeProvidedInConstructor":
                            responseDictionary = LoadWhenAMessageIsPublishedThenOptionalSecretKeyShouldBeProvidedInConstructor();
                            break;
                        case "IfSSLNotProvidedThenDefaultShouldBeFalse":
                            responseDictionary = LoadWhenAMessageIsPublishedIfSSLNotProvidedThenDefaultShouldBeFalse();
                            break;
                        case "ThenDisableJsonEncodeShouldSendSerializedObjectMessage":
                            responseDictionary = LoadWhenAMessageIsPublishedThenDisableJsonEncodeShouldSendSerializedObjectMessage();
                            break;
                        case "ThenLargeMessageShoudFailWithMessageTooLargeInfo":
                            responseDictionary = LoadWhenAMessageIsPublishedThenLargeMessageShoudFailWithMessageTooLargeInfo();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenDetailedHistoryIsRequested":
                    switch (_testCaseName)
                    {
                        case "DetailHistoryCount10ReturnsRecords":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReturnsRecords();
                            break;
                        case "DetailHistoryCount10ReverseTrueReturnsRecords":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReverseTrueReturnsRecords();
                            break;
                        case "DetailedHistoryStartWithReverseTrue":
                            responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryStartWithReverseTrue();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenGetRequestServerTime":
                    switch (_testCaseName)
                    {
                        case "ThenItShouldReturnTimeStamp":
                            responseDictionary = LoadWhenGetRequestServerTimeThenItShouldReturnTimeStamp();
                            break;
                        case "ThenWithProxyItShouldReturnTimeStamp":
                            responseDictionary = LoadWhenGetRequestServerTimeThenWithProxyItShouldReturnTimeStamp();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenSubscribedToAChannel":
                    switch (_testCaseName)
                    {
                        case "ThenSubscribeShouldReturnReceivedMessage":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedMessage();
                            break;
                        case "ThenSubscribeShouldReturnConnectStatus":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnConnectStatus();
                            break;
                        case "ThenMultiSubscribeShouldReturnConnectStatus":
                            responseDictionary = LoadWhenSubscribedToAChannelThenMultiSubscribeShouldReturnConnectStatus();
                            break;
                        case "ThenDuplicateChannelShouldReturnAlreadySubscribed":
                            responseDictionary = LoadWhenSubscribedToAChannelThenDuplicateChannelShouldReturnAlreadySubscribed();
                            break;
                        case "ThenSubscriberShouldBeAbleToReceiveManyMessages":
                            responseDictionary = LoadWhenSubscribedToAChannelThenSubscriberShouldBeAbleToReceiveManyMessages();
                            break;
                        default:
                            break;
                    }
                    break;
                case "WhenUnsubscribedToAChannel":
                    switch (_testCaseName)
                    {
                        case "ThenShouldReturnUnsubscribedMessage":
                            responseDictionary = LoadWhenUnsubscribedToAChannelThenShouldReturnUnsubscribedMessage();
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }

            if (responseDictionary != null && responseDictionary.ContainsKey(requestUri.AbsolutePath))
            {
                stubResponse = responseDictionary[requestUri.AbsolutePath];
                if (_testClassName == "WhenAMessageIsPublished" && _testCaseName == "ThenLargeMessageShoudFailWithMessageTooLargeInfo")
                {
                    PubnubWebResponse stubWebResponse = new PubnubWebResponse(new MemoryStream(Encoding.UTF8.GetBytes(stubResponse)), HttpStatusCode.BadRequest);
#if (SILVERLIGHT || WINDOWS_PHONE)
                    WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.Pending, stubWebResponse);
#else
                    WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.ProtocolError, stubWebResponse);
#endif
                    throw largeMessageException;
                }
            }
            else
            {
                stubResponse = "!! Stub Response Not Assigned !!";
            }
            if (stubResponse == "!! Stub Response Not Assigned !!")
            {
                System.Diagnostics.Debug.WriteLine("requestUri.AbsolutePath = " + requestUri.AbsolutePath);
                System.Diagnostics.Debug.WriteLine("stubResponse = " + stubResponse);
            }
            return stubResponse;
        }
예제 #4
0
        public string GetStubResponse(HttpWebRequest request)
        {
            Uri requestUri = request.RequestUri;

            Dictionary <string, string> responseDictionary = null;
            string stubResponse = "!! Stub Response Not Assigned !!";

            System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}", _testClassName, _testCaseName));
            switch (_testClassName)
            {
            case "WhenAClientIsPresented":
                switch (_testCaseName)
                {
                case "ThenPresenceShouldReturnReceivedMessage":
                    responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnReceivedMessage();
                    break;

                case "ThenPresenceShouldReturnCustomUUID":
                    responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnCustomUUID();
                    break;

                case "IfHereNowIsCalledThenItShouldReturnInfo":
                    responseDictionary = LoadWhenAClientIsPresentedIfHereNowIsCalledThenItShouldReturnInfo();
                    break;

                default:
                    break;
                }
                break;

            case "WhenAMessageIsPublished":
                switch (_testCaseName)
                {
                case "ThenUnencryptPublishShouldReturnSuccessCodeAndInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptPublishShouldReturnSuccessCodeAndInfo();
                    break;

                case "ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo();
                    break;

                case "ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo();
                    break;

                case "ThenEncryptPublishShouldReturnSuccessCodeAndInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenEncryptPublishShouldReturnSuccessCodeAndInfo();
                    break;

                case "ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo();
                    break;

                case "ThenComplexMessageObjectShouldReturnSuccessCodeAndInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenComplexMessageObjectShouldReturnSuccessCodeAndInfo();
                    break;

                case "ThenOptionalSecretKeyShouldBeProvidedInConstructor":
                    responseDictionary = LoadWhenAMessageIsPublishedThenOptionalSecretKeyShouldBeProvidedInConstructor();
                    break;

                case "IfSSLNotProvidedThenDefaultShouldBeFalse":
                    responseDictionary = LoadWhenAMessageIsPublishedIfSSLNotProvidedThenDefaultShouldBeFalse();
                    break;

                case "ThenDisableJsonEncodeShouldSendSerializedObjectMessage":
                    responseDictionary = LoadWhenAMessageIsPublishedThenDisableJsonEncodeShouldSendSerializedObjectMessage();
                    break;

                case "ThenLargeMessageShoudFailWithMessageTooLargeInfo":
                    responseDictionary = LoadWhenAMessageIsPublishedThenLargeMessageShoudFailWithMessageTooLargeInfo();
                    break;

                default:
                    break;
                }
                break;

            case "WhenDetailedHistoryIsRequested":
                switch (_testCaseName)
                {
                case "DetailHistoryCount10ReturnsRecords":
                    responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReturnsRecords();
                    break;

                case "DetailHistoryCount10ReverseTrueReturnsRecords":
                    responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReverseTrueReturnsRecords();
                    break;

                case "DetailedHistoryStartWithReverseTrue":
                    responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryStartWithReverseTrue();
                    break;

                default:
                    break;
                }
                break;

            case "WhenGetRequestServerTime":
                switch (_testCaseName)
                {
                case "ThenItShouldReturnTimeStamp":
                    responseDictionary = LoadWhenGetRequestServerTimeThenItShouldReturnTimeStamp();
                    break;

                case "ThenWithProxyItShouldReturnTimeStamp":
                    responseDictionary = LoadWhenGetRequestServerTimeThenWithProxyItShouldReturnTimeStamp();
                    break;

                default:
                    break;
                }
                break;

            case "WhenSubscribedToAChannel":
                switch (_testCaseName)
                {
                case "ThenSubscribeShouldReturnReceivedMessage":
                    responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedMessage();
                    break;

                case "ThenSubscribeShouldReturnConnectStatus":
                    responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnConnectStatus();
                    break;

                case "ThenMultiSubscribeShouldReturnConnectStatus":
                    responseDictionary = LoadWhenSubscribedToAChannelThenMultiSubscribeShouldReturnConnectStatus();
                    break;

                case "ThenDuplicateChannelShouldReturnAlreadySubscribed":
                    responseDictionary = LoadWhenSubscribedToAChannelThenDuplicateChannelShouldReturnAlreadySubscribed();
                    break;

                case "ThenSubscriberShouldBeAbleToReceiveManyMessages":
                    responseDictionary = LoadWhenSubscribedToAChannelThenSubscriberShouldBeAbleToReceiveManyMessages();
                    break;

                default:
                    break;
                }
                break;

            case "WhenUnsubscribedToAChannel":
                switch (_testCaseName)
                {
                case "ThenShouldReturnUnsubscribedMessage":
                    responseDictionary = LoadWhenUnsubscribedToAChannelThenShouldReturnUnsubscribedMessage();
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }

            if (responseDictionary != null && responseDictionary.ContainsKey(requestUri.AbsolutePath))
            {
                stubResponse = responseDictionary[requestUri.AbsolutePath];
                if (_testClassName == "WhenAMessageIsPublished" && _testCaseName == "ThenLargeMessageShoudFailWithMessageTooLargeInfo")
                {
                    PubnubWebResponse stubWebResponse = new PubnubWebResponse(new MemoryStream(Encoding.UTF8.GetBytes(stubResponse)), HttpStatusCode.BadRequest);
#if (SILVERLIGHT || WINDOWS_PHONE)
                    WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.Pending, stubWebResponse);
#else
                    WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.ProtocolError, stubWebResponse);
#endif
                    throw largeMessageException;
                }
            }
            else
            {
                stubResponse = "!! Stub Response Not Assigned !!";
            }
            if (stubResponse == "!! Stub Response Not Assigned !!")
            {
                System.Diagnostics.Debug.WriteLine("requestUri.AbsolutePath = " + requestUri.AbsolutePath);
                System.Diagnostics.Debug.WriteLine("stubResponse = " + stubResponse);
            }
            return(stubResponse);
        }
예제 #5
0
		public PubnubClientError(int statusCode, PubnubErrorSeverity errorSeverity, string message, PubnubMessageSource source, PubnubWebRequest pubnubWebRequest, PubnubWebResponse pubnubWebResponse, string description, string channel)
		{
			_dateTimeGMT = DateTime.Now.ToUniversalTime();
			_statusCode = statusCode;
			_isDotNetException = false;
			_message = message;
			_errorSeverity = errorSeverity;
			_messageSource = source;
			_channel = channel;
			_detailedDotNetException = null;
			_pubnubWebRequest = pubnubWebRequest;
			_pubnubWebResponse = pubnubWebResponse;
			_description = description;
		}
예제 #6
0
		public string GetStubResponse(HttpWebRequest request)
		{
			Uri requestUri = request.RequestUri;

			Dictionary<string,string> responseDictionary = null;
			string stubResponse = "!! Stub Response Not Assigned !!";
			//string lookUpString = request.PathAndQuery;

			switch (_testClassName)
			{
				case "WhenAClientIsPresented":
				switch (_testCaseName)
				{
					case "ThenPresenceShouldReturnReceivedMessage":
					responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnReceivedMessage();
					break;
					case "ThenPresenceShouldReturnReceivedMessageCipher":
					responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnReceivedMessageCipher();
					break;
					case "IfHereNowIsCalledThenItShouldReturnInfo":
					responseDictionary = LoadWhenAClientIsPresentedIfHereNowIsCalledThenItShouldReturnInfo();
					break;
					case "ThenPresenceShouldReturnCustomUUID":
					responseDictionary = LoadWhenAClientIsPresentedThenPresenceShouldReturnCustomUUID();
					break;
					default:
					break;
				}
				break;
				case "WhenAMessageIsPublished":
				switch (_testCaseName)
				{

					case "ThenItShouldReturnSuccessCodeAndInfoForEncryptedComplexMessage2":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfoForEncryptedComplexMessage2();
					break;
					case "ThenItShouldReturnSuccessCodeAndInfoForComplexMessage2":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfoForComplexMessage2();
					break;
					case "ThenItShouldReturnSuccessCodeAndInfoForComplexMessage2WithSsl":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfoForComplexMessage2WithSsl();
					break;
					case "ThenItShouldReturnSuccessCodeAndInfoForComplexMessage":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfoForComplexMessage();
					break;
					case "ThenItShouldReturnSuccessCodeAndInfoWhenEncryptedAndSecretKeyed":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfoWhenEncryptedAndSecretKeyed();
					break;
					case "ThenItShouldReturnSuccessCodeAndInfoWhenEncrypted":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfoWhenEncrypted();
					break;
					case "ThenItShouldReturnSuccessCodeAndInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenItShouldReturnSuccessCodeAndInfo();
					break;
					case "ThenUnencryptPublishShouldReturnSuccessCodeAndInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptPublishShouldReturnSuccessCodeAndInfo();
					break;
					case "ThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenUnencryptObjectPublishShouldReturnSuccessCodeAndInfo();
					break;
					case "ThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenEncryptObjectPublishShouldReturnSuccessCodeAndInfo();
					break;
					case "ThenEncryptPublishShouldReturnSuccessCodeAndInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenEncryptPublishShouldReturnSuccessCodeAndInfo();
					break;
					case "ThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenSecretKeyWithEncryptPublishShouldReturnSuccessCodeAndInfo();
					break;
					case "ThenOptionalSecretKeyShouldBeProvidedInConstructor":
					responseDictionary = LoadWhenAMessageIsPublishedThenOptionalSecretKeyShouldBeProvidedInConstructor();
					break;
					case "IfSSLNotProvidedThenDefaultShouldBeFalse":
					responseDictionary = LoadWhenAMessageIsPublishedIfSSLNotProvidedThenDefaultShouldBeFalse();
					break;
					case "ThenLargeMessageShoudFailWithMessageTooLargeInfo":
					responseDictionary = LoadWhenAMessageIsPublishedThenLargeMessageShoudFailWithMessageTooLargeInfo();    
					break;
					default:
					break;
				}
				break;
				case "WhenDetailedHistoryIsRequested":
				switch (_testCaseName)
				{

					case "DetailedHistoryDecryptedExample":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryDecryptedExample();
					break;
					case "TestUnencryptedSecretDetailedHistoryParams1":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedSecretDetailedHistoryParams1();
					break;
					case "TestUnencryptedSecretDetailedHistoryParams2":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedSecretDetailedHistoryParams2();
					break;
					case "TestUnencryptedSecretDetailedHistoryParams3":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedSecretDetailedHistoryParams3();
					break;
					case "TestEncryptedSecretDetailedHistoryParams1":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedSecretDetailedHistoryParams1();
					break;
					case "TestEncryptedSecretDetailedHistoryParams2":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedSecretDetailedHistoryParams2();
					break;
					case "TestEncryptedSecretDetailedHistoryParams3":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedSecretDetailedHistoryParams3();
					break;
					case "TestUnencryptedDetailedHistoryParams1":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedDetailedHistoryParams1();
					break;
					case "TestUnencryptedDetailedHistoryParams2":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedDetailedHistoryParams2();
					break;
					case "TestUnencryptedDetailedHistoryParams3":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedDetailedHistoryParams3();
					break;
					case "TestEncryptedDetailedHistory":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedDetailedHistory();
					break;
					case "TestUnencryptedDetailedHistory":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestUnencryptedDetailedHistory();
					break;
					case "ItShouldReturnDetailedHistory":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedItShouldReturnDetailedHistory();
					break;
					case "TestEncryptedDetailedHistoryParams1":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedDetailedHistoryParams1();
					break;
					case "TestEncryptedDetailedHistoryParams2":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedDetailedHistoryParams2();
					break;
					case "TestEncryptedDetailedHistoryParams3":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedTestEncryptedDetailedHistoryParams3();
					break;
					case "DetailHistoryCount10ReturnsRecords":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReturnsRecords();
					break;
					case "DetailHistoryCount10ReverseTrueReturnsRecords":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailHistoryCount10ReverseTrueReturnsRecords();
					break;
					case "DetailedHistoryStartWithReverseTrue":
					responseDictionary = LoadWhenDetailedHistoryIsRequestedDetailedHistoryStartWithReverseTrue();
					break;
					default:
					break;
				}
				break;
				case "WhenGetRequestServerTime":
				switch (_testCaseName)
				{
					case "ThenItShouldReturnTimeStamp":
					responseDictionary = LoadWhenGetRequestServerTimeThenItShouldReturnTimeStamp();
					break;
					default:
					break;
				}
				break;
				case "WhenSubscribedToAChannel":
				switch (_testCaseName)
				{
					case "ThenSubscriberShouldBeAbleToReceiveManyMessages":
					responseDictionary = LoadWhenSubscribedToAChannelThenSubscriberShouldBeAbleToReceiveManyMessages();
					break;
					case "ThenDuplicateChannelShouldReturnAlreadySubscribed":
					responseDictionary = LoadWhenSubscribedToAChannelThenDuplicateChannelShouldReturnAlreadySubscribed();
					break;
					case "ThenMultiSubscribeShouldReturnConnectStatus":
					responseDictionary = LoadWhenSubscribedToAChannelThenMultiSubscribeShouldReturnConnectStatus();
					break;
					case "ThenItShouldReturnReceivedMessageForComplexMessage":
					responseDictionary = LoadWhenSubscribedToAChannelThenItShouldReturnReceivedMessageForComplexMessage();
					break;    
					case "ThenItShouldReturnReceivedMessageCipherForComplexMessage":
					responseDictionary = LoadWhenSubscribedToAChannelThenItShouldReturnReceivedMessageCipherForComplexMessage();
					break;
					case "ThenSubscribeShouldReturnReceivedMessageCipher":
					responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedMessageCipher();
					break;    
					case "ThenSubscribeShouldReturnReceivedMessage":
					responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnReceivedMessage();
					break;
					case "ThenSubscribeShouldReturnConnectStatus":
					responseDictionary = LoadWhenSubscribedToAChannelThenSubscribeShouldReturnConnectStatus();
					break;
					default:
					break;
				}
				break;
				case "WhenUnsubscribedToAChannel":
				switch (_testCaseName)
				{
					case "ThenShouldReturnUnsubscribedMessage":
					responseDictionary = LoadWhenUnsubscribedToAChannelThenShouldReturnUnsubscribedMessage();
					break;
					case "ThenNonExistentChannelShouldReturnNotSubscribed":
					responseDictionary = LoadWhenUnsubscribedToAChannelThenNonExistentChannelShouldReturnNotSubscribed();
					break;
					default:
					break;
				}
				break;
				default:
				break;
			}
			if (responseDictionary != null && responseDictionary.ContainsKey(requestUri.AbsolutePath))
			{
				stubResponse = responseDictionary[requestUri.AbsolutePath];
				if (_testClassName == "WhenAMessageIsPublished" && _testCaseName == "ThenLargeMessageShoudFailWithMessageTooLargeInfo")
				{
					PubnubWebResponse stubWebResponse = new PubnubWebResponse(new MemoryStream(Encoding.UTF8.GetBytes(stubResponse)), HttpStatusCode.BadRequest);
					WebException largeMessageException = new WebException("The remote server returned an error: (400) Bad Request", null, WebExceptionStatus.ProtocolError, stubWebResponse);
					throw largeMessageException;
				}
			}
			else
			{
				stubResponse = "!! Stub Response Not Assigned !!";
			}

			return stubResponse;
		}