Esempio n. 1
0
        public void GetServiceRoutes_CalledWithNullServiceType_ExpectArgumentNullExceptionWithCorrectParamName(
            [WithinInclusiveRange(1, 10)] int numberOfInnerResolvers)
        {
            var resolver = new AggregateServiceRouteResolver(
                numberOfInnerResolvers.Select(x => MockRepository.GenerateStub <IServiceRouteResolver>()));

            resolver.Invoking(x => x.GetServiceRoutes(null)).ShouldThrow <ArgumentNullException>().And.ParamName.Should().Be("serviceType");
        }
		public void GetServiceRoutes_CalledWithNullServiceType_ExpectArgumentNullExceptionWithCorrectParamName(
			[WithinInclusiveRange(1, 10)] int numberOfInnerResolvers)
		{
			var resolver = new AggregateServiceRouteResolver(
				numberOfInnerResolvers.Select(x => MockRepository.GenerateStub<IServiceRouteResolver>()));

			resolver.Invoking(x => x.GetServiceRoutes(null)).ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("serviceType");
		}
		public void GetServiceRoutes_CalledMultipleTimes_ExpectEnumerableOfInnerResolversIsOnlyEnumeratedOnce(
			Type serviceType, Type anotherServiceType)
		{
			var innerResolvers = Mock.Enumerable<IServiceRouteResolver>();
			var resolver = new AggregateServiceRouteResolver(innerResolvers);
			resolver.GetServiceRoutes(serviceType).ForEach(x => { });
			resolver.GetServiceRoutes(anotherServiceType).ForEach(x => { });

			innerResolvers.AssertWasCalled(x => x.GetEnumerator(), x => x.Repeat.Once());
		}
Esempio n. 4
0
        public void GetServiceRoutes_CalledMultipleTimes_ExpectEnumerableOfInnerResolversIsOnlyEnumeratedOnce(
            Type serviceType, Type anotherServiceType)
        {
            var innerResolvers = Mock.Enumerable <IServiceRouteResolver>();
            var resolver       = new AggregateServiceRouteResolver(innerResolvers);

            resolver.GetServiceRoutes(serviceType).ForEach(x => { });
            resolver.GetServiceRoutes(anotherServiceType).ForEach(x => { });

            innerResolvers.AssertWasCalled(x => x.GetEnumerator(), x => x.Repeat.Once());
        }