Projektdateien hinzufügen.
This commit is contained in:
39
VideoBrowserTestApp/Tests/AboutViewTest.cs
Normal file
39
VideoBrowserTestApp/Tests/AboutViewTest.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using VideoBrowser.ViewModels;
|
||||
using VideoBrowser.Views;
|
||||
using VideoBrowserTestApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="AboutViewTest" />.
|
||||
/// </summary>
|
||||
public class AboutViewTest : TestBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AboutViewTest"/> class.
|
||||
/// </summary>
|
||||
public AboutViewTest() : base(nameof(AboutView))
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected override void Test(Window testWindow)
|
||||
{
|
||||
var viewModel = new AboutViewModel();
|
||||
var view = new AboutView { DataContext = viewModel };
|
||||
WindowFactory.CreateAndShow(view, testWindow);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
59
VideoBrowserTestApp/Tests/DefaultTabHostWindowTest.cs
Normal file
59
VideoBrowserTestApp/Tests/DefaultTabHostWindowTest.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using VideoBrowser.Controls.CefSharpBrowser;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.Views;
|
||||
using VideoBrowser.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="DefaultTabHostWindowTest" />.
|
||||
/// </summary>
|
||||
public class DefaultTabHostWindowTest : TestBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DefaultTabHostWindowTest"/> class.
|
||||
/// </summary>
|
||||
public DefaultTabHostWindowTest() : base(nameof(DefaultTabHostWindow))
|
||||
{
|
||||
this.GlobalBrowserData = new GlobalBrowserData();
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the GlobalBrowserData.
|
||||
/// </summary>
|
||||
private GlobalBrowserData GlobalBrowserData { get; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected override void Test(Window testWindow)
|
||||
{
|
||||
var client = this.GlobalBrowserData.InterTabClient;
|
||||
DefaultTabHostWindow window = null;
|
||||
UIThreadHelper.Invoke(() =>
|
||||
{
|
||||
var viewModel = new DefaultTabHostViewModel(this.GlobalBrowserData);
|
||||
var browserTabModel = viewModel.WebBrowserTabControlViewModel;
|
||||
var tab = new WebBrowserHeaderedItemViewModel(this.GlobalBrowserData, browserTabModel.CefWindowData, null);
|
||||
//browserTabModel.TabItems.Add(tab);
|
||||
window = new DefaultTabHostWindow { DataContext = viewModel };
|
||||
});
|
||||
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
41
VideoBrowserTestApp/Tests/DownloadQueueViewTest.cs
Normal file
41
VideoBrowserTestApp/Tests/DownloadQueueViewTest.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using VideoBrowser.Controls.CefSharpBrowser;
|
||||
using VideoBrowser.ViewModels;
|
||||
using VideoBrowser.Views;
|
||||
using VideoBrowserTestApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="DownloadQueueViewTest" />.
|
||||
/// </summary>
|
||||
public class DownloadQueueViewTest : TestBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DownloadQueueViewTest"/> class.
|
||||
/// </summary>
|
||||
public DownloadQueueViewTest() : base(nameof(DownloadQueueView))
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected override void Test(Window testWindow)
|
||||
{
|
||||
var globalBrowserData = new GlobalBrowserData();
|
||||
var viewModel = new DownloadQueueViewModel(globalBrowserData.DownloadItemModels);
|
||||
var view = new DownloadQueueView { DataContext = viewModel };
|
||||
WindowFactory.CreateAndShow(view, testWindow);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
39
VideoBrowserTestApp/Tests/SettingsViewTest.cs
Normal file
39
VideoBrowserTestApp/Tests/SettingsViewTest.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.Views;
|
||||
using VideoBrowserTestApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="SettingsViewTest" />.
|
||||
/// </summary>
|
||||
public class SettingsViewTest : TestBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SettingsViewTest"/> class.
|
||||
/// </summary>
|
||||
public SettingsViewTest() : base(nameof(SettingsView))
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected override void Test(Window testWindow)
|
||||
{
|
||||
var viewModel = new SettingsViewModel();
|
||||
var view = new SettingsView { DataContext = viewModel };
|
||||
WindowFactory.CreateAndShow(view, testWindow);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
60
VideoBrowserTestApp/Tests/TestBase.cs
Normal file
60
VideoBrowserTestApp/Tests/TestBase.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using VideoBrowser.Common;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="TestBase" />.
|
||||
/// </summary>
|
||||
public abstract class TestBase : NotifyPropertyChanged
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TestBase"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name<see cref="string"/>.</param>
|
||||
protected TestBase(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
this.TestCommand = new RelayCommand(this.InternalTest, nameof(this.TestCommand));
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Name.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the TestCommand.
|
||||
/// </summary>
|
||||
public ICommand TestCommand { get; }
|
||||
|
||||
#endregion Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected abstract void Test(Window testWindow);
|
||||
|
||||
/// <summary>
|
||||
/// The InternalTest.
|
||||
/// </summary>
|
||||
/// <param name="obj">The obj<see cref="object"/>.</param>
|
||||
private void InternalTest(object obj)
|
||||
{
|
||||
Properties.Settings.Default.LastTest = this.Name;
|
||||
this.Test(obj as Window);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
47
VideoBrowserTestApp/Tests/UrlEditorViewTest.cs
Normal file
47
VideoBrowserTestApp/Tests/UrlEditorViewTest.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
|
||||
using VideoBrowser.Core;
|
||||
using VideoBrowser.ViewModels;
|
||||
using VideoBrowser.Views;
|
||||
using VideoBrowserTestApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="UrlEditorViewTest" />.
|
||||
/// </summary>
|
||||
public class UrlEditorViewTest : TestBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UrlEditorViewTest"/> class.
|
||||
/// </summary>
|
||||
public UrlEditorViewTest() : base(nameof(UrlEditorView))
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected override void Test(Window testWindow)
|
||||
{
|
||||
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, testWindow);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
45
VideoBrowserTestApp/Tests/WebBrowserTabControlViewTest.cs
Normal file
45
VideoBrowserTestApp/Tests/WebBrowserTabControlViewTest.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace VideoBrowserTestApp.Tests
|
||||
{
|
||||
using System.Windows;
|
||||
using VideoBrowser.Controls.CefSharpBrowser;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.ViewModels;
|
||||
using VideoBrowser.Controls.CefSharpBrowser.Views;
|
||||
using VideoBrowserTestApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="WebBrowserTabControlViewTest" />.
|
||||
/// </summary>
|
||||
public class WebBrowserTabControlViewTest : TestBase
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WebBrowserTabControlViewTest"/> class.
|
||||
/// </summary>
|
||||
public WebBrowserTabControlViewTest() : base(nameof(WebBrowserTabControlView))
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// The Test.
|
||||
/// </summary>
|
||||
/// <param name="testWindow">The testWindow<see cref="Window"/>.</param>
|
||||
protected override void Test(Window testWindow)
|
||||
{
|
||||
var globalBrowserData = new GlobalBrowserData();
|
||||
var viewModel = new WebBrowserTabControlViewModel(globalBrowserData);
|
||||
var cefWindowData = viewModel.CefWindowData;
|
||||
var view = new WebBrowserTabControlView { DataContext = viewModel };
|
||||
var window = WindowFactory.Create(view, testWindow);
|
||||
viewModel.TabItems.Add(new WebBrowserHeaderedItemViewModel(globalBrowserData, cefWindowData, null));
|
||||
cefWindowData.MainWindow = window; ;
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user