public void GetDescriptorWithArgumentCaches()
        {
            // Arrange
            Type controllerType = typeof(object);
            ControllerDescriptorCache cache = new ControllerDescriptorCache();
            object argument = new object();

            // Act
            ControllerDescriptor descriptor1 = cache.GetDescriptor(
                controllerType,
                (object innerState) =>
                {
                    Assert.Same(argument, innerState);
                    return new ReflectedControllerDescriptor(controllerType);
                },
                argument);
            ControllerDescriptor descriptor2 = cache.GetDescriptor(
                controllerType,
                (object innerState) =>
                {
                    Assert.Same(argument, innerState);
                    return new ReflectedControllerDescriptor(controllerType);
                },
                argument);

            // Assert
            Assert.Same(controllerType, descriptor1.ControllerType);
            Assert.Same(descriptor1, descriptor2);
        }
        public void GetDescriptorWithArgumentCaches()
        {
            // Arrange
            Type controllerType             = typeof(object);
            ControllerDescriptorCache cache = new ControllerDescriptorCache();
            object argument = new object();

            // Act
            ControllerDescriptor descriptor1 = cache.GetDescriptor(
                controllerType,
                (object innerState) =>
            {
                Assert.Same(argument, innerState);
                return(new ReflectedControllerDescriptor(controllerType));
            },
                argument
                );
            ControllerDescriptor descriptor2 = cache.GetDescriptor(
                controllerType,
                (object innerState) =>
            {
                Assert.Same(argument, innerState);
                return(new ReflectedControllerDescriptor(controllerType));
            },
                argument
                );

            // Assert
            Assert.Same(controllerType, descriptor1.ControllerType);
            Assert.Same(descriptor1, descriptor2);
        }
        public void GetDescriptor() {
            // Arrange
            Type controllerType = typeof(object);
            ControllerDescriptorCache cache = new ControllerDescriptorCache();

            // Act
            ControllerDescriptor descriptor1 = cache.GetDescriptor(controllerType);
            ControllerDescriptor descriptor2 = cache.GetDescriptor(controllerType);

            // Assert
            Assert.AreSame(controllerType, descriptor1.ControllerType, "ControllerType was incorrect.");
            Assert.AreSame(descriptor1, descriptor2, "Selector was not correctly cached.");
        }
        public void GetDescriptor()
        {
            // Arrange
            Type controllerType             = typeof(object);
            ControllerDescriptorCache cache = new ControllerDescriptorCache();

            // Act
            ControllerDescriptor descriptor1 = cache.GetDescriptor(controllerType, () => new ReflectedControllerDescriptor(controllerType));
            ControllerDescriptor descriptor2 = cache.GetDescriptor(controllerType, () => new ReflectedControllerDescriptor(controllerType));

            // Assert
            Assert.Same(controllerType, descriptor1.ControllerType);
            Assert.Same(descriptor1, descriptor2);
        }
        public void GetDescriptorCaches()
        {
            // Arrange
            Type controllerType = typeof(object);
            ControllerDescriptorCache cache = new ControllerDescriptorCache();

            // Act
            ControllerDescriptor descriptor1 = cache.GetDescriptor(controllerType, () => new ReflectedControllerDescriptor(controllerType));
            ControllerDescriptor descriptor2 = cache.GetDescriptor(controllerType, () => new ReflectedControllerDescriptor(controllerType));

            // Assert
            Assert.Same(controllerType, descriptor1.ControllerType);
            Assert.Same(descriptor1, descriptor2);
        }
        public void GetDescriptor()
        {
            // Arrange
            Type controllerType             = typeof(object);
            ControllerDescriptorCache cache = new ControllerDescriptorCache();

            // Act
            ControllerDescriptor descriptor1 = cache.GetDescriptor(controllerType, () => new ReflectedControllerDescriptor(controllerType));
            ControllerDescriptor descriptor2 = cache.GetDescriptor(controllerType, () => new ReflectedControllerDescriptor(controllerType));

            // Assert
            Assert.AreSame(controllerType, descriptor1.ControllerType, "ControllerType was incorrect.");
            Assert.AreSame(descriptor1, descriptor2, "Selector was not correctly cached.");
        }
Esempio n. 7
0
 static ApiControllerActionInvoker()
 {
     _staticDescriptorCache = new ControllerDescriptorCache();
 }
 public AsyncControllerActionInvokerHelper()
 {
     DescriptorCache = new ControllerDescriptorCache();
 }
Esempio n. 9
0
 static AjaxActionInvoker()
 {
     descriptorCache = new ControllerDescriptorCache();
 }
 public AsyncControllerActionInvokerHelper()
 {
     DescriptorCache = new ControllerDescriptorCache();
 }