コード例 #1
0
        public void GenerateReturnsUriTest()
        {
            var target = new UriValueGenerator();

            var actual = target.Generate(typeof(Uri), null, null);

            actual.Should().NotBeNull();
            actual.As<Uri>().ToString().Should().NotBeNullOrEmpty();
        }
コード例 #2
0
        public void GenerateReturnsStringForUrlParameterNameTest()
        {
            var target = new UriValueGenerator();

            var actual = target.Generate(typeof(string), "url", null);

            actual.Should().NotBeNull();
            actual.As<string>().Should().NotBeNullOrEmpty();
        }
コード例 #3
0
        public void GenerateThrowsExceptionWithNullTypeTest()
        {
            var buildChain = new LinkedList<object>();

            buildChain.AddFirst(Guid.NewGuid().ToString());

            var target = new UriValueGenerator();

            Action action = () => target.Generate(null, Guid.NewGuid().ToString(), buildChain);

            action.ShouldThrow<ArgumentNullException>();
        }
コード例 #4
0
        public void GenerateValidatesUnsupportedScenariosTest(Type type, string referenceName, bool supported)
        {
            var target = new UriValueGenerator();

            Action action = () => target.Generate(type, referenceName, null);

            if (supported)
            {
                action.ShouldNotThrow();
            }
            else
            {
                action.ShouldThrow<NotSupportedException>();
            }
        }
コード例 #5
0
        public void IsSupportedReturnsWhetherScenarioIsValidTest(Type type, string referenceName, bool supported)
        {
            var target = new UriValueGenerator();

            var actual = target.IsSupported(type, referenceName, null);

            actual.Should().Be(supported);
        }
コード例 #6
0
        public void PriorityIsHigherThanStringValueGeneratorProprityTest()
        {
            var target = new UriValueGenerator();
            var other = new StringValueGenerator();

            target.Priority.Should().BeGreaterThan(other.Priority);
        }