public override void TearDown()
 {
     this.controller         = null;
     this.nexuServiceMock    = null;
     this.mappingEngineMock  = null;
     this.contentServiceMock = null;
     base.TearDown();
 }
示例#2
0
        public override void Initialize()
        {
            base.Initialize();

            this.nexuServiceMock    = new Mock <INexuService>();
            this.mappingEngineMock  = new Mock <IMappingEngine>();
            this.contentServiceMock = new Mock <IContentService>();
            this.mediaServiceMock   = new Mock <IMediaService>();

            // Mocked settings are now necessary
            SettingsForTests.ConfigureSettings(SettingsForTests.GenerateMockSettings());

            // Routing context necessary for published content request
            this.RouteData = new RouteData();
            var routingContext = this.GetRoutingContext(
                "http://localhost",
                -1,
                this.RouteData,
                true,
                UmbracoConfig.For.UmbracoSettings());

            // setup umbraco context
            this.UmbracoContext = routingContext.UmbracoContext;

            this.controller = new NexuApiController(
                this.UmbracoContext,
                this.nexuServiceMock.Object,
                this.mappingEngineMock.Object,
                this.contentServiceMock.Object,
                this.mediaServiceMock.Object)
            {
                Request = new HttpRequestMessage
                {
                    Properties =
                    {
                        {
                            HttpPropertyKeys.HttpConfigurationKey,
                            new HttpConfiguration()
                        }
                    }
                }
            };
        }