public void Initialize_SetsContractResolver()
        {
            // Arrange
            this.tableExtension.Initialize(this.config);
            var controllerSettings = new HttpControllerSettings(this.config);
            var tableControllerConfig = new TableControllerConfigAttribute();

            // Act
            tableControllerConfig.Initialize(controllerSettings, new HttpControllerDescriptor(this.config, "Dummy", typeof(TableController)));

            // Assert
            Assert.IsType<TableContractResolver>(controllerSettings.Formatters.JsonFormatter.SerializerSettings.ContractResolver);
        }
        public TableContractResolverTests()
        {
            var config = new HttpConfiguration();

            // Formatter initialization happens in the TableControllerConfigAttribute
            TableControllerConfigAttribute tableConfig = new TableControllerConfigAttribute();
            var descriptor = new HttpControllerDescriptor { Configuration = config };
            var settings = new HttpControllerSettings(config);
            tableConfig.Initialize(settings, descriptor);

            this.formatter = settings.Formatters.JsonFormatter;
            this.resolverMock = new Mock<TableContractResolver>(this.formatter) { CallBase = true };
            this.resolver = this.resolverMock.Object;
        }
Ejemplo n.º 3
0
 public TableControllerConfigAttributeTests()
 {
     this.tableControllerConfig = new TableControllerConfigAttribute();
 }
 public TableControllerConfigAttributeTests()
 {
     this.tableControllerConfig = new TableControllerConfigAttribute();
 }