public void ProgressFileDownloaderUnitTestDownloadAsyncDownloadStopedAndProgressDialogClosed() { //init var mockWebClient = new Mock<IDev2WebClient>(); mockWebClient.Setup(c => c.CancelAsync()).Verifiable(); var mockProgressDialog = new Mock<IProgressDialog>(); mockProgressDialog.Setup(c => c.Close()).Verifiable(); ProgressFileDownloader.GetProgressDialogViewModel = (x, y) => mockProgressDialog.Object; var testProgressFileDownloader = new TestProgressFileDownloader(mockWebClient.Object, new Mock<IFile>().Object,new Mock<ICryptoProvider>().Object); //exe testProgressFileDownloader.TestCancelDownload(); //assert mockWebClient.Verify(c => c.CancelAsync()); }
public void ProgressFileDownloader_UnitTest_RehydrateDialog_ProgressDialogRehydrated() { //init var mockWebClient = new Mock<IDev2WebClient>(); var mockProgressDialog = new Mock<IProgressDialog>(); mockProgressDialog.Setup(c => c.StatusChanged(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<long>())).Verifiable(); ProgressFileDownloader.GetProgressDialogViewModel = (x, y) => mockProgressDialog.Object; var testProgressFileDownloader = new TestProgressFileDownloader(mockWebClient.Object, new Mock<IFile>().Object,new Mock<ICryptoProvider>().Object); //exe testProgressFileDownloader.TestRehydrateDialog("test file", 50, 2000); #pragma warning disable 168 var actual = testProgressFileDownloader.GetProgressDialog(); #pragma warning restore 168 //assert mockProgressDialog.Verify(c => c.StatusChanged(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<long>()), Times.Once()); }
public void ProgressFileDownloader_UnitTest_OnDownloadFileCompleted_DialogClosed() { //init var mockWebClient = new Mock<IDev2WebClient>(); var mockProgressDialog = new Mock<IProgressDialog>(); mockProgressDialog.Setup(c => c.Close()).Verifiable(); ProgressFileDownloader.GetProgressDialogViewModel = (x, y) => mockProgressDialog.Object; var testProgressFileDownloader = new TestProgressFileDownloader(mockWebClient.Object, new Mock<IFile>().Object,new Mock<ICryptoProvider>().Object); //exe testProgressFileDownloader.TestStartUpdate("test file", true); //assert mockProgressDialog.Verify(c => c.Close()); Assert.IsFalse(testProgressFileDownloader.IsBusyDownloading); }