public void TimestampRequestIsNotWithinTolerance()
        {
            var request = new ValidationRequest
            {
                HttpRequest = new HttpRequestMessage
                {
                    Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } },
                    Headers =
                        {
                            { Sdk.SIGNATURE_CERT_URL_REQUEST_HEADER, "TestSignatureCertChainUrlValue" },
                            { Sdk.SIGNATURE_REQUEST_HEADER, "TestSignatureValue" }
                        },
                    Content = new StringContent(OutdatedMessage)
                },
                RequestTime = DateTime.UtcNow
            };

            var speechlet = new EmptySpeechlet();
            var response = speechlet.OnRequestValidation(request);

            Assert.True((response.ValidationResult & SpeechletRequestValidationResult.InvalidTimestamp) ==
                            SpeechletRequestValidationResult.InvalidTimestamp);
        }
        public void RequestIsValid()
        {
            var request = new ValidationRequest
            {
                HttpRequest = new HttpRequestMessage
                {
                    Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } },
                    Headers =
                        {
                            { Sdk.SIGNATURE_CERT_URL_REQUEST_HEADER, "TestSignatureCertChainUrlValue" },
                            { Sdk.SIGNATURE_REQUEST_HEADER, "TestSignatureValue" }
                        },
                    Content = new StringContent(GenericSuccessMessage)
                },
                RequestTime = DateTime.UtcNow
            };

            var speechlet = new EmptySpeechlet();
            var response = speechlet.OnRequestValidation(request);

            //Need to validate no errors except for InvalidSignature since SSL Cert not supplied <see cref="SignatureVerifierTests">
            Assert.True(
                    (response.ValidationResult & SpeechletRequestValidationResult.NoCertHeader) != SpeechletRequestValidationResult.NoCertHeader
                    &&
                    (response.ValidationResult & SpeechletRequestValidationResult.NoSignatureHeader) != SpeechletRequestValidationResult.NoSignatureHeader
                    &&
                    (response.ValidationResult & SpeechletRequestValidationResult.InvalidJson) != SpeechletRequestValidationResult.InvalidJson
                    &&
                    (response.ValidationResult & SpeechletRequestValidationResult.InvalidSpeechlet) != SpeechletRequestValidationResult.InvalidSpeechlet
                    &&
                    (response.ValidationResult & SpeechletRequestValidationResult.InvalidTimestamp) != SpeechletRequestValidationResult.InvalidTimestamp
                    &&
                    (response.ValidationResult & SpeechletRequestValidationResult.Error) != SpeechletRequestValidationResult.Error
                    );
        }
        public void HeaderContainsBlankSignatureFails()
        {
            var request = new ValidationRequest
            {
                HttpRequest = new HttpRequestMessage
                {
                    Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } },
                    Headers =
                        {
                            { Sdk.SIGNATURE_CERT_URL_REQUEST_HEADER, "TestSignatureCertChainUrlValue" },
                            { Sdk.SIGNATURE_REQUEST_HEADER, "" }
                        },
                    Content = new StringContent(GenericSuccessMessage)
                }
            };

            var speechlet = new EmptySpeechlet();
            var response = speechlet.OnRequestValidation(request);

            Assert.True((response.ValidationResult & SpeechletRequestValidationResult.NoSignatureHeader) ==
                            SpeechletRequestValidationResult.NoSignatureHeader);
        }