Projektdateien hinzufügen.
This commit is contained in:
30
VideoBrowser.Test/Views/AboutViewTest.cs
Normal file
30
VideoBrowser.Test/Views/AboutViewTest.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace VideoBrowser.Test.Views
|
||||
{
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using VideoBrowser.Test.Common;
|
||||
using VideoBrowser.Test.TestHelpers;
|
||||
using VideoBrowser.ViewModels;
|
||||
using VideoBrowser.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="AboutViewTest" />.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class AboutViewTest
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Show_AboutView.
|
||||
/// </summary>
|
||||
[TestMethod, ManualTest]
|
||||
public void Show_AboutView()
|
||||
{
|
||||
var viewModel = new AboutViewModel();
|
||||
var view = new AboutView { DataContext = viewModel };
|
||||
WindowFactory.CreateAndShow(view);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
69
VideoBrowser.Test/Views/DownloadQueueViewTest.cs
Normal file
69
VideoBrowser.Test/Views/DownloadQueueViewTest.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
namespace VideoBrowser.Test.Views
|
||||
{
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using VideoBrowser.Controls.CefSharpBrowser;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.Models;
|
||||
using VideoBrowser.Core;
|
||||
using VideoBrowser.Models;
|
||||
using VideoBrowser.Test.Common;
|
||||
using VideoBrowser.Test.TestHelpers;
|
||||
using VideoBrowser.ViewModels;
|
||||
using VideoBrowser.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="DownloadQueueViewTest" />.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class DownloadQueueViewTest
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Show_DownloadQueueView.
|
||||
/// </summary>
|
||||
[TestMethod, ManualTest]
|
||||
public void Show_DownloadQueueView()
|
||||
{
|
||||
var globalBrowserData = new GlobalBrowserData();
|
||||
var viewModel = new DownloadQueueViewModel(globalBrowserData.DownloadItemModels);
|
||||
this.CreateDummyOperations(viewModel.DownloadItemModels, viewModel.OnPauseDownloadCalled);
|
||||
var view = new DownloadQueueView { DataContext = viewModel };
|
||||
WindowFactory.CreateAndShow(view);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The CreateDummyOperations.
|
||||
/// </summary>
|
||||
/// <param name="operations">The operations<see cref="ObservableCollection{OperationModel}"/>.</param>
|
||||
/// <param name="pauseDownloadAction">The pauseDownloadAction<see cref="ICommand"/>.</param>
|
||||
private void CreateDummyOperations(ObservableCollection<DownloadItemModel> operations, Action<DownloadItemModel> pauseDownloadAction)
|
||||
{
|
||||
var random = new Random();
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
var operation = new DummyOperation() { Status = (OperationStatus)(i % 6) };
|
||||
var operationModel = new OperationModel(operation) { PauseDownloadAction = pauseDownloadAction, IsQueuedControlsVisible = (i & 1) == 1 };
|
||||
var progress = TestHelper.GetRandomLong(0, 100);
|
||||
operation.Duration = TestHelper.GetRandomLong(10, 10000);
|
||||
operation.FileSize = TestHelper.GetRandomLong(10000, 10000000000);
|
||||
operation.Input = $"https://youtube.com/view={i}";
|
||||
operation.Link = $"https://youtube.com/link={i}"; ;
|
||||
operation.Output = $@"C:\Users\YoutubeUser\File{TestHelper.GetRandomLong(100, 10000)}.mp4";
|
||||
operation.Progress = progress;
|
||||
operation.ProgressPercentage = (int)progress;
|
||||
operation.ProgressText = $"{progress}%";
|
||||
operation.ReportsProgress = true;
|
||||
operation.Speed = $"{TestHelper.GetRandomInt(10, 100)}MB/s";
|
||||
operation.Status = (OperationStatus)(i % 6);
|
||||
operation.Thumbnail = null;
|
||||
operation.Title = $"Youtube Title Movie Number {i}";
|
||||
operations.Add(operationModel);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
30
VideoBrowser.Test/Views/SettingsViewTest.cs
Normal file
30
VideoBrowser.Test/Views/SettingsViewTest.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace VideoBrowser.Test.Views
|
||||
{
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.Views;
|
||||
using VideoBrowser.Test.Common;
|
||||
using VideoBrowser.Test.TestHelpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="SettingsViewTest" />.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class SettingsViewTest
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Show_SettingsView.
|
||||
/// </summary>
|
||||
[TestMethod, ManualTest]
|
||||
public void Show_SettingsView()
|
||||
{
|
||||
var viewModel = new SettingsViewModel();
|
||||
var view = new SettingsView { DataContext = viewModel };
|
||||
WindowFactory.CreateAndShow(view);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
38
VideoBrowser.Test/Views/UrlEditorViewTest.cs
Normal file
38
VideoBrowser.Test/Views/UrlEditorViewTest.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace VideoBrowser.Test.Views
|
||||
{
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Windows.Controls;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
|
||||
using VideoBrowser.Core;
|
||||
using VideoBrowser.Test.Common;
|
||||
using VideoBrowser.Test.TestHelpers;
|
||||
using VideoBrowser.ViewModels;
|
||||
using VideoBrowser.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="UrlEditorViewTest" />.
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class UrlEditorViewTest
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Show_UrlEditorView.
|
||||
/// </summary>
|
||||
[TestMethod, ManualTest]
|
||||
public void Show_UrlEditorView()
|
||||
{
|
||||
var urlReader = new UrlReader();
|
||||
var settings = new SettingsViewModel();
|
||||
var viewModelA = new UrlEditorViewModel(urlReader, settings) { IsVisible = true, FileName = "Youtube Video File Name", FileSize = "5 MB", Duration = "00:02:45" };
|
||||
var viewModelB = new UrlEditorViewModel(urlReader, settings) { IsVisible = true, FileName = "Youtube Video File Name", FileSize = "1.4 MB", Duration = "00:02:45", IsBusy = true };
|
||||
var stackPanel = new StackPanel();
|
||||
stackPanel.Children.Add(new UrlEditorView { DataContext = viewModelA });
|
||||
stackPanel.Children.Add(new UrlEditorView { DataContext = viewModelB });
|
||||
WindowFactory.CreateAndShow(stackPanel);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user