public void SetUp() { iAppShell = new Mock<IAppShell>(); iProvider = new Mock<IAppManagerProvider>(); iDownloadManager = new Mock<IDownloadManager>(); iProviderConstructor = new FuncMock<DvDevice,IAppManagerActionHandler,string,IAppManagerProvider>(); iProviderConstructor.Mock.Setup(x => x.Invoke(It.IsAny<DvDevice>(), It.IsAny<IAppManagerActionHandler>(), It.IsAny<string>())).Returns(iProvider.Object); iAppManager = new AppManager( "http://app.test/resource", new DvDevice[] { null }, iProviderConstructor.Func, iAppShell.Object, iDownloadManager.Object); }
public void Start(IAppContext aAppServices) { if (aAppServices.Device == null) throw new ArgumentNullException("aAppServices.Device"); var appDevice = aAppServices.Device; var nodeDevice = aAppServices.Services.NodeDeviceAccessor.Device.RawDevice; string appResourceUrl = string.Format("/{0}/Upnp/resource/", appDevice.Udn()); var downloadDirectory = new DownloadDirectory(aAppServices.StorePath); var urlFetcher = new DefaultUrlFetcher(); downloadDirectory.Clear(); iDownloadManager = new DownloadManager(downloadDirectory, urlFetcher); iAppManager = new AppManager( appResourceUrl, new[]{appDevice, nodeDevice}, (d,m,uri)=>new AppManagerProvider(d,m,uri), aAppServices.Services.ResolveService<IAppShell>(), iDownloadManager); iResourceManager = new NodeResourceManager(Path.Combine(aAppServices.StaticPath, "WebUi"), aAppServices.Device.Udn(), aAppServices.Services.NodeInformation.WebSocketPort ?? 0); }