Пример #1
0
        public void TryParseShouldReturnCorrectVersion()
        {
            var version = VersionValidator.TryParse("1.1", TestObjectFactory.GetFailingValidationAction());

            Assert.Equal(1, version.Major);
            Assert.Equal(1, version.Minor);
        }
Пример #2
0
        public void TryParseShouldInvokeFailedActionIfStringIsNotInCorrectFormat()
        {
            var exception = Assert.Throws <NullReferenceException>(() =>
            {
                VersionValidator.TryParse("test", TestObjectFactory.GetFailingValidationAction());
            });

            Assert.Equal("version valid version string invalid one", exception.Message);
        }
Пример #3
0
        /// <summary>
        /// Tests whether HTTP response message version is the same as the provided version as string.
        /// </summary>
        /// <param name="version">Expected version as string.</param>
        /// <returns>The same HTTP response message test builder.</returns>
        public IAndHttpResponseMessageTestBuilder WithVersion(string version)
        {
            var parsedVersion = VersionValidator.TryParse(version, this.ThrowNewHttpResponseMessageAssertionException);

            return(this.WithVersion(parsedVersion));
        }
Пример #4
0
        /// <summary>
        /// Adds HTTP version to the built HTTP request message.
        /// </summary>
        /// <param name="version">HTTP version provided by string.</param>
        /// <returns>The same HTTP request message builder.</returns>
        public IAndHttpRequestMessageBuilder WithVersion(string version)
        {
            var parsedVersion = VersionValidator.TryParse(version, this.ThrowNewInvalidHttpRequestMessageException);

            return(this.WithVersion(parsedVersion));
        }
Пример #5
0
 public void TryParseShouldInvokeFailedActionIfStringIsNotInCorrectFormat()
 {
     VersionValidator.TryParse("test", TestObjectFactory.GetFailingValidationAction());
 }