public MainViewModel( Application app, ILogger logger, IResourceProvider resProvider, IApplicationControlFileProvider appControlFileProvider, IFileSystemHelper fsHelper, IByteConverter byteConverter, ICrashReporter crashReporter, IAnalyticsEngine analyticsEngine, IGenerator playlistGenerator, IDriveVolumeInfoViewFactory driveVolumeInfoViewFactory, IApplicationControlFileFactory applicationControlFileFactory) : base(app) { Logger = logger; Logger.Debug(() => $"MainViewModel:ctor"); ApplicationContext = app; ResourceProvider = resProvider; ApplicationControlFileProvider = appControlFileProvider; FileSystemHelper = fsHelper; ByteConverter = byteConverter; CrashReporter = crashReporter; AnalyticsEngine = analyticsEngine; PlaylistGenerator = playlistGenerator; DriveVolumeInfoViewFactory = driveVolumeInfoViewFactory; ApplicationControlFileFactory = applicationControlFileFactory; }
public void Setup() { ResetObservedResults(); MockApplication = A.Fake <Application>(); A.CallTo(() => MockApplication.PackageName).Returns("com.andrewandderek.podcastutilities"); MockLogger = A.Fake <ILogger>(); MockResourceProvider = A.Fake <IResourceProvider>(); MockFileSystemHelper = A.Fake <IFileSystemHelper>(); // there is 10MB free in the filesystem A.CallTo(() => MockFileSystemHelper.GetAvailableFileSystemSizeInBytes(A <string> .Ignored)).Returns(1024 * 1024 * FREE_DISK_SPACE_MB); MockApplicationControlFileProvider = A.Fake <IApplicationControlFileProvider>(); MockCrashReporter = A.Fake <ICrashReporter>(); MockAnalyticsEngine = A.Fake <IAnalyticsEngine>(); MockApplicationControlFileFactory = A.Fake <IApplicationControlFileFactory>(); MockPodcastEpisodeFinder = A.Fake <IEpisodeFinder>(); MockSyncItemToEpisodeDownloaderTaskConverter = A.Fake <ISyncItemToEpisodeDownloaderTaskConverter>(); MockTaskPool = A.Fake <ITaskPool>(); MockStatusAndProgressMessageStore = A.Fake <IStatusAndProgressMessageStore>(); MockNetworkHelper = A.Fake <INetworkHelper>(); A.CallTo(() => MockNetworkHelper.ActiveNetworkType).Returns(INetworkHelper.NetworkType.Wifi); MockUserSettings = A.Fake <IUserSettings>(); ByteConverter = new ByteConverter(); SetupResources(); ViewModel = new DownloadViewModel( MockApplication, MockLogger, MockResourceProvider, MockApplicationControlFileProvider, MockFileSystemHelper, ByteConverter, MockPodcastEpisodeFinder, MockSyncItemToEpisodeDownloaderTaskConverter, MockTaskPool, MockCrashReporter, MockAnalyticsEngine, MockStatusAndProgressMessageStore, MockNetworkHelper, MockUserSettings ); ViewModel.Observables.Title += SetTitle; ViewModel.Observables.SetEmptyText += SetEmptyText; ViewModel.Observables.StartProgress += StartProgress; ViewModel.Observables.UpdateProgress += UpdateProgress; ViewModel.Observables.EndProgress += EndProgress; ViewModel.Observables.SetSyncItems += SetSyncItems; ViewModel.Observables.DisplayMessage += DisplayMessage; ViewModel.Observables.CellularPrompt += CellularPrompt; ViewModel.Observables.StartDownloading += StartDownloading; ViewModel.Observables.EndDownloading += EndDownloading; ViewModel.Observables.UpdateItemProgress += UpdateItemProgress; ViewModel.Observables.UpdateItemStatus += UpdateItemStatus; ViewModel.Observables.ExitPrompt += ExitPrompt; ViewModel.Observables.Exit += Exit; }
public void Setup() { ResetObservedResults(); MockApplication = A.Fake <Application>(); A.CallTo(() => MockApplication.PackageName).Returns("com.andrewandderek.podcastutilities"); MockLogger = A.Fake <ILogger>(); MockResourceProvider = A.Fake <IResourceProvider>(); MockFileSystemHelper = A.Fake <IFileSystemHelper>(); MockApplicationControlFileProvider = A.Fake <IApplicationControlFileProvider>(); MockCrashReporter = A.Fake <ICrashReporter>(); MockAnalyticsEngine = A.Fake <IAnalyticsEngine>(); MockPlaylistGenerator = A.Fake <IGenerator>(); MockDriveVolumeInfoViewFactory = A.Fake <IDriveVolumeInfoViewFactory>(); MockDriveVolumeInfoView = A.Fake <IDriveVolumeInfoView>(); A.CallTo(() => MockDriveVolumeInfoViewFactory.GetNewView(MockApplication)).Returns(MockDriveVolumeInfoView); MockApplicationControlFileFactory = A.Fake <IApplicationControlFileFactory>(); ByteConverter = new ByteConverter(); SetupResources(); ViewModel = new MainViewModel( MockApplication, MockLogger, MockResourceProvider, MockApplicationControlFileProvider, MockFileSystemHelper, ByteConverter, MockCrashReporter, MockAnalyticsEngine, MockPlaylistGenerator, MockDriveVolumeInfoViewFactory, MockApplicationControlFileFactory ); ViewModel.Observables.Title += SetTitle; ViewModel.Observables.SetCacheRoot += SetCacheRoot; ViewModel.Observables.SetFeedItems += SetFeedItems; ViewModel.Observables.ShowNoDriveMessage += ShowNoDriveMessage; ViewModel.Observables.AddInfoView += AddInfoView; ViewModel.Observables.ToastMessage += ToastMessage; }