Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added dialog support

-Added OpenFileDialog
-Added SaveFileDialog
-Added DialogService
-Added public/private key generation
-Fixed build scripts to build and run AdminTool tests and package the output
  • Loading branch information...
commit ecf7f749db273fb4a8a3a2b19b5614b3b6d43d21 1 parent 05969b8
@HEskandari HEskandari authored
Showing with 2,093 additions and 780 deletions.
  1. +68 −0 Rhino.Licensing.AdminTool.Tests/Dialogs/FileDialogTests.cs
  2. +56 −0 Rhino.Licensing.AdminTool.Tests/Dialogs/OpenFileDialogTests.cs
  3. +58 −0 Rhino.Licensing.AdminTool.Tests/Dialogs/SaveFileDialogTests.cs
  4. +3 −3 Rhino.Licensing.AdminTool.Tests/GuyWireTests.cs
  5. +18 −0 Rhino.Licensing.AdminTool.Tests/Models/ProjectModelTests.cs
  6. +8 −1 Rhino.Licensing.AdminTool.Tests/Rhino.Licensing.AdminTool.Tests.csproj
  7. +76 −0 Rhino.Licensing.AdminTool.Tests/Services/DialogServiceTests.cs
  8. +29 −0 Rhino.Licensing.AdminTool.Tests/ViewModels/DialogViewModelTests.cs
  9. +88 −2 Rhino.Licensing.AdminTool.Tests/ViewModels/ProjectViewModelTests.cs
  10. +27 −6 Rhino.Licensing.AdminTool.Tests/ViewModels/ShellViewModelTests.cs
  11. +13 −0 Rhino.Licensing.AdminTool/App.xaml
  12. +51 −0 Rhino.Licensing.AdminTool/Dialogs/FileDialog.cs
  13. +38 −0 Rhino.Licensing.AdminTool/Dialogs/OpenFileDialog.cs
  14. +41 −0 Rhino.Licensing.AdminTool/Dialogs/SaveFileDialog.cs
  15. +7 −1 Rhino.Licensing.AdminTool/Extensions/ReflectionExtensions.cs
  16. +15 −0 Rhino.Licensing.AdminTool/Extensions/StringExtensions.cs
  17. +22 −0 Rhino.Licensing.AdminTool/Factories/IDialogFactory.cs
  18. +5 −3 Rhino.Licensing.AdminTool/Factories/{ViewModelFactory.cs → IViewModelFactory.cs}
  19. +1 −0  Rhino.Licensing.AdminTool/Model/Product.cs
  20. +2 −0  Rhino.Licensing.AdminTool/Model/Project.cs
  21. +47 −6 Rhino.Licensing.AdminTool/Rhino.Licensing.AdminTool.csproj
  22. +70 −0 Rhino.Licensing.AdminTool/Services/DialogService.cs
  23. +11 −13 Rhino.Licensing.AdminTool/{Factories/ProjectFactory.cs → Services/ProjectService.cs}
  24. +22 −0 Rhino.Licensing.AdminTool/Startup/FactoryRegistration.cs
  25. +3 −1 Rhino.Licensing.AdminTool/Startup/GuyWire.cs
  26. +1 −1  Rhino.Licensing.AdminTool/Startup/ViewModelRegistration.cs
  27. +122 −0 Rhino.Licensing.AdminTool/ViewModels/FileDialogViewModel.cs
  28. +0 −7 Rhino.Licensing.AdminTool/ViewModels/IViewModel.cs
  29. +22 −0 Rhino.Licensing.AdminTool/ViewModels/OpenFileDialogViewModel.cs
  30. +46 −0 Rhino.Licensing.AdminTool/ViewModels/ProjectViewModel.cs
  31. +34 −0 Rhino.Licensing.AdminTool/ViewModels/SaveFileDialogViewModel.cs
  32. +26 −6 Rhino.Licensing.AdminTool/ViewModels/ShellViewModel.cs
  33. +5 −1 Rhino.Licensing.AdminTool/Views/AboutView.xaml.cs
  34. +37 −13 Rhino.Licensing.AdminTool/Views/ProjectView.xaml
  35. +5 −1 Rhino.Licensing.AdminTool/Views/ProjectView.xaml.cs
  36. +5 −1 Rhino.Licensing.AdminTool/Views/ShellView.xaml.cs
  37. +2 −2 Rhino.Licensing.Tests/Can_check_trial_date.cs
  38. +1 −1  Rhino.Licensing.Tests/Can_generate_and_validate_key.cs
  39. +1 −1  Rhino.Licensing.Tests/Can_use_floating_licenses.cs
  40. +1 −2  Rhino.Licensing.Tests/Rhino.Licensing.Tests.csproj
  41. +2 −0  Rhino.Licensing/Rhino.Licensing.csproj
  42. BIN  SharedLibs/xunit.dll
  43. +500 −242 SharedLibs/xunit.xml
  44. +122 −84 default.ps1
  45. +2 −2 how to run the tests.txt
  46. +24 −24 license.txt
  47. +311 −311 psake.ps1
  48. +45 −45 psake_ext.ps1
View
68 Rhino.Licensing.AdminTool.Tests/Dialogs/FileDialogTests.cs
@@ -0,0 +1,68 @@
+using System.Windows.Forms;
+using Rhino.Licensing.AdminTool.ViewModels;
+using Rhino.Mocks;
+using Xunit;
+using System.Linq;
+using FileDialog = Rhino.Licensing.AdminTool.Dialogs.FileDialog;
+
+namespace Rhino.Licensing.AdminTool.Tests.Dialogs
+{
+ public class FileDialogTests
+ {
+ [Fact]
+ public void ShowDialog_Sets_Selected_Files()
+ {
+ var dialogForm = MockRepository.GenerateMock<System.Windows.Forms.FileDialog>();
+
+ var model = new OpenFileDialogViewModel();
+ var dialog = new TestFileDialog(dialogForm, model);
+
+ dialogForm.Expect(x => x.ShowDialog()).Return(DialogResult.OK);
+ dialogForm.Expect(x => x.FileName).Return("License.lic");
+ dialogForm.Expect(x => x.FileNames).Return(new[] {"License.lic", "License2.lic"});
+
+ dialog.ShowDialog();
+
+ Assert.Equal("License.lic", model.FileName);
+ Assert.Contains("License.lic", model.FileNames);
+ Assert.Contains("License2.lic", model.FileNames);
+ Assert.Equal(2, model.FileNames.Count());
+ }
+
+ [Fact]
+ public void Dialog_Disposes_Upon_Destruction()
+ {
+ var dialogForm = MockRepository.GenerateMock<System.Windows.Forms.FileDialog>();
+
+ var model = new OpenFileDialogViewModel();
+ var dialog = new TestFileDialog(dialogForm, model);
+
+ dialog.ShowDialog();
+ dialog.Dispose();
+
+ dialogForm.AssertWasCalled(x => x.Dispose(), x => x.Repeat.Once());
+ }
+
+ public class TestFileDialog : FileDialog
+ {
+ private System.Windows.Forms.FileDialog _dialog;
+ private IFileDialogViewModel _viewModel;
+
+ public TestFileDialog(System.Windows.Forms.FileDialog dialog, IFileDialogViewModel viewModel)
+ {
+ _dialog = dialog;
+ _viewModel = viewModel;
+ }
+
+ protected override System.Windows.Forms.FileDialog Dialog
+ {
+ get { return _dialog; }
+ }
+
+ public override IFileDialogViewModel ViewModel
+ {
+ get { return _viewModel; }
+ }
+ }
+ }
+}
View
56 Rhino.Licensing.AdminTool.Tests/Dialogs/OpenFileDialogTests.cs
@@ -0,0 +1,56 @@
+using Rhino.Licensing.AdminTool.Dialogs;
+using Rhino.Licensing.AdminTool.ViewModels;
+using Xunit;
+
+namespace Rhino.Licensing.AdminTool.Tests.Dialogs
+{
+ public class OpenFileDialogTests
+ {
+ [Fact]
+ public void Dialog_Wires_Model_Properties()
+ {
+ var model = CreateOpenFileDialogModel();
+ var dialog = new OpenFileDialogStub(model);
+ var dialogForm = dialog.GetCoreDialog();
+
+ Assert.True(dialogForm.AddExtension);
+ Assert.True(dialogForm.CheckFileExists);
+ Assert.True(dialogForm.CheckPathExists);
+ Assert.False(dialogForm.Multiselect);
+ Assert.Equal("rlic", dialogForm.DefaultExt);
+ Assert.Equal("Rhino License Project|*.rlic", dialogForm.Filter);
+ Assert.Equal("C:\\", dialogForm.InitialDirectory);
+ Assert.Equal("Open File Dialog", dialogForm.Title);
+ }
+
+ private IOpenFileDialogViewModel CreateOpenFileDialogModel()
+ {
+ var model = new OpenFileDialogViewModel
+ {
+ AddExtension = true,
+ CheckFileExists = true,
+ CheckPathExists = true,
+ DefaultExtension = "rlic",
+ Filter = "Rhino License Project|*.rlic",
+ InitialDirectory = "C:\\",
+ MultiSelect = false,
+ Title = "Open File Dialog"
+ };
+
+ return model;
+ }
+
+ public class OpenFileDialogStub : OpenFileDialog
+ {
+ public OpenFileDialogStub(IOpenFileDialogViewModel viewModel)
+ : base(viewModel)
+ {
+ }
+
+ public System.Windows.Forms.OpenFileDialog GetCoreDialog()
+ {
+ return base.Dialog as System.Windows.Forms.OpenFileDialog;
+ }
+ }
+ }
+}
View
58 Rhino.Licensing.AdminTool.Tests/Dialogs/SaveFileDialogTests.cs
@@ -0,0 +1,58 @@
+using Rhino.Licensing.AdminTool.Dialogs;
+using Rhino.Licensing.AdminTool.ViewModels;
+using Xunit;
+
+namespace Rhino.Licensing.AdminTool.Tests.Dialogs
+{
+ public class SaveFileDialogTests
+ {
+ [Fact]
+ public void Dialog_Wires_Model_Properties()
+ {
+ var model = CreateOpenFileDialogModel();
+ var dialog = new OpenFileDialogStub(model);
+ var dialogForm = dialog.GetCoreDialog();
+
+ Assert.True(dialogForm.AddExtension);
+ Assert.True(dialogForm.CheckFileExists);
+ Assert.True(dialogForm.CheckPathExists);
+ Assert.True(dialogForm.OverwritePrompt);
+ Assert.True(dialogForm.SupportMultiDottedExtensions);
+ Assert.Equal("rlic", dialogForm.DefaultExt);
+ Assert.Equal("Rhino License Project|*.rlic", dialogForm.Filter);
+ Assert.Equal("C:\\", dialogForm.InitialDirectory);
+ Assert.Equal("Save File Dialog", dialogForm.Title);
+ }
+
+ private ISaveFileDialogViewModel CreateOpenFileDialogModel()
+ {
+ var model = new SaveFileDialogViewModel
+ {
+ AddExtension = true,
+ CheckFileExists = true,
+ CheckPathExists = true,
+ OverwritePrompt = true,
+ SupportMultiDottedExtensions = true,
+ DefaultExtension = "rlic",
+ Filter = "Rhino License Project|*.rlic",
+ InitialDirectory = "C:\\",
+ Title = "Save File Dialog",
+ };
+
+ return model;
+ }
+
+ public class OpenFileDialogStub : SaveFileDialog
+ {
+ public OpenFileDialogStub(ISaveFileDialogViewModel viewModel)
+ : base(viewModel)
+ {
+ }
+
+ public System.Windows.Forms.SaveFileDialog GetCoreDialog()
+ {
+ return base.Dialog as System.Windows.Forms.SaveFileDialog;
+ }
+ }
+ }
+}
View
6 Rhino.Licensing.AdminTool.Tests/GuyWireTests.cs
@@ -27,7 +27,7 @@ public void GuyWire_Registers_Correct_Components()
var guyWire = new GuyWire();
var count = guyWire.ComponentsInfo.Count();
- Assert.Equal(2, count);
+ Assert.Equal(4, count);
}
[Fact]
@@ -59,12 +59,12 @@ public void GuyWire_Disposes_Container_Upon_Dewire()
public void Can_Show_Root_ViewModel()
{
var winManager = MockRepository.GenerateMock<IWindowManager>();
- var shell = MockRepository.GenerateMock<ShellViewModel>();
+ var shell = MockRepository.GenerateMock<IShellViewModel>();
var container = new WindsorContainer();
var guyWire = new GuyWire(container);
container.Kernel.AddComponentInstance<IWindowManager>(winManager);
- container.Kernel.AddComponentInstance<ShellViewModel>(shell);
+ container.Kernel.AddComponentInstance<IShellViewModel>(shell);
guyWire.ShowRootModel();
View
18 Rhino.Licensing.AdminTool.Tests/Models/ProjectModelTests.cs
@@ -0,0 +1,18 @@
+using Rhino.Licensing.AdminTool.Model;
+using Xunit;
+using Caliburn.Testability.Extensions;
+
+namespace Rhino.Licensing.AdminTool.Tests.Models
+{
+ public class ProjectModelTests
+ {
+ [Fact]
+ public void Project_Fires_Property_Changed()
+ {
+ var project = new Project();
+
+ project.AssertThatAllProperties()
+ .RaiseChangeNotification();
+ }
+ }
+}
View
9 Rhino.Licensing.AdminTool.Tests/Rhino.Licensing.AdminTool.Tests.csproj
@@ -77,21 +77,28 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
- <Reference Include="xunit, Version=1.1.0.1323, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+ <Reference Include="xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SharedLibs\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="Dialogs\FileDialogTests.cs" />
+ <Compile Include="Dialogs\OpenFileDialogTests.cs" />
+ <Compile Include="Dialogs\SaveFileDialogTests.cs" />
<Compile Include="GuyWireTests.cs" />
<Compile Include="Models\ProductModelTests.cs" />
+ <Compile Include="Models\ProjectModelTests.cs" />
+ <Compile Include="Services\DialogServiceTests.cs" />
<Compile Include="ViewModels\AboutViewModelTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="ViewModels\DialogViewModelTests.cs" />
<Compile Include="ViewModels\ProjectViewModelTests.cs" />
<Compile Include="ViewModels\ShellViewModelTests.cs" />
</ItemGroup>
View
76 Rhino.Licensing.AdminTool.Tests/Services/DialogServiceTests.cs
@@ -0,0 +1,76 @@
+using System.Windows.Forms;
+using Rhino.Licensing.AdminTool.Factories;
+using Rhino.Licensing.AdminTool.Services;
+using Rhino.Licensing.AdminTool.ViewModels;
+using Rhino.Mocks;
+using Xunit;
+using OpenFileDialog = Rhino.Licensing.AdminTool.Dialogs.OpenFileDialog;
+using SaveFileDialog = Rhino.Licensing.AdminTool.Dialogs.SaveFileDialog;
+
+namespace Rhino.Licensing.AdminTool.Tests.Services
+{
+ public class DialogServiceTests
+ {
+ [Fact(Skip = "Not Completed")]
+ public void Can_Show_OpenFileDialog()
+ {
+ var model = CreateOpenFileDialogModel();
+ var factory = MockRepository.GenerateMock<IDialogFactory>();
+ var dialog = MockRepository.GenerateMock<OpenFileDialog>(model);
+
+ factory.Expect(x => x.Create<OpenFileDialog>(Arg.Is(model))).Return(dialog);
+ dialog.Expect(x => x.ShowDialog()).Return(DialogResult.OK);
+ dialog.Expect(x => x.ViewModel).Return(model);
+
+ new DialogService(factory).ShowOpenFileDialog(model);
+
+ dialog.AssertWasCalled(x => x.ShowDialog(), x => x.Repeat.Once());
+ }
+
+ [Fact(Skip = "Not Completed")]
+ public void Can_Show_SaveFileDialog()
+ {
+ var model = CreateSaveFileDialogModel();
+ var factory = MockRepository.GenerateMock<IDialogFactory>();
+ var dialog = MockRepository.GenerateMock<SaveFileDialog>(model);
+
+ var service = new DialogService(factory) as IDialogService;
+
+ factory.Expect(x => x.Create<SaveFileDialog>(Arg.Is(model))).Return(dialog);
+
+ service.ShowSaveFileDialog(model);
+
+ dialog.AssertWasCalled(x => x.ShowDialog(), x => x.Repeat.Once());
+ }
+
+ private IOpenFileDialogViewModel CreateOpenFileDialogModel()
+ {
+ return new OpenFileDialogViewModel
+ {
+ AddExtension = true,
+ CheckFileExists = true,
+ CheckPathExists = true,
+ DefaultExtension = "rlic",
+ Filter = "Rhino License Project|*.rlic",
+ InitialDirectory = "C:\\",
+ MultiSelect = false,
+ Title = "Open File Dialog"
+ };
+ }
+
+ private ISaveFileDialogViewModel CreateSaveFileDialogModel()
+ {
+ return new SaveFileDialogViewModel
+ {
+ AddExtension = true,
+ CheckFileExists = true,
+ CheckPathExists = true,
+ DefaultExtension = "rlic",
+ Filter = "Rhino License Project|*.rlic",
+ InitialDirectory = "C:\\",
+ Title = "Open File Dialog"
+ };
+ }
+
+ }
+}
View
29 Rhino.Licensing.AdminTool.Tests/ViewModels/DialogViewModelTests.cs
@@ -0,0 +1,29 @@
+using Rhino.Licensing.AdminTool.ViewModels;
+using Xunit;
+using Caliburn.Testability.Extensions;
+
+namespace Rhino.Licensing.AdminTool.Tests.ViewModels
+{
+ public class DialogViewModelTests
+ {
+ [Fact]
+ public void FileDialogModel_Fires_PropertyChange()
+ {
+ var vm = new OpenFileDialogViewModel();
+
+ vm.AssertThatAllProperties()
+ .RaiseChangeNotification();
+ }
+
+ [Fact]
+ public void SaveDialogModel_Fires_PropertyChange()
+ {
+ var vm = new SaveFileDialogViewModel();
+
+ vm.AssertThatAllProperties()
+ .RaiseChangeNotification();
+ }
+
+
+ }
+}
View
90 Rhino.Licensing.AdminTool.Tests/ViewModels/ProjectViewModelTests.cs
@@ -1,5 +1,7 @@
using Rhino.Licensing.AdminTool.Model;
+using Rhino.Licensing.AdminTool.Services;
using Rhino.Licensing.AdminTool.ViewModels;
+using Rhino.Mocks;
using Xunit;
using Caliburn.Testability.Extensions;
@@ -7,10 +9,19 @@ namespace Rhino.Licensing.AdminTool.Tests.ViewModels
{
public class ProjectViewModelTests
{
+ private readonly IDialogService _dialogService;
+ private readonly IProjectService _projectService;
+
+ public ProjectViewModelTests()
+ {
+ _dialogService = MockRepository.GenerateMock<IDialogService>();
+ _projectService = MockRepository.GenerateMock<IProjectService>();
+ }
+
[Fact]
public void Creating_New_ProductViewModel_Will_Have_Empty_Product()
{
- var vm = new ProjectViewModel();
+ var vm = CreateViewModel();
Assert.Null(vm.CurrentProject);
}
@@ -18,9 +29,84 @@ public void Creating_New_ProductViewModel_Will_Have_Empty_Product()
[Fact]
public void Fires_PropertyChange_Notification()
{
- var vm = new ProjectViewModel();
+ var vm = CreateViewModel();
vm.AssertThatProperty(x => x.CurrentProject).RaisesChangeNotification();
}
+
+ [Fact]
+ public void Can_Not_Save_If_Name_Is_Not_Provided()
+ {
+ var vm = CreateViewModel();
+
+ vm.CurrentProject = new Project
+ {
+ Product = new Product
+ {
+ Name = null
+ }
+ };
+
+ Assert.False(vm.CanSave());
+ }
+
+ [Fact]
+ public void Can_Save_If_Name_Is_Provided()
+ {
+ var vm = CreateViewModel();
+
+ vm.CurrentProject = new Project
+ {
+ Product = new Product
+ {
+ Name = "New Product"
+ }
+ };
+
+ Assert.True(vm.CanSave());
+ }
+
+ [Fact]
+ public void Save_Action_Will_Open_SaveDialog()
+ {
+ var vm = CreateViewModel();
+
+ vm.Save();
+
+ _dialogService.AssertWasCalled(x => x.ShowSaveFileDialog(Arg<ISaveFileDialogViewModel>.Is.Anything), x => x.Repeat.Once());
+ }
+
+ [Fact]
+ public void Will_Proceed_To_Save_When_Dialog_Successfully_Closes()
+ {
+ var vm = CreateViewModel();
+ var project = new Project();
+
+ _dialogService.Expect(x => x.ShowSaveFileDialog(Arg<ISaveFileDialogViewModel>.Is.Anything)).Return(true);
+
+ vm.CurrentProject = project;
+ vm.Save();
+
+ _projectService.AssertWasCalled(x => x.Save(Arg.Is(project)));
+ }
+
+ [Fact]
+ public void Can_Generate_Key_Pair()
+ {
+ var vm = CreateViewModel();
+
+ vm.CurrentProject = new Project {Product = new Product()};
+ vm.GenerateKey();
+
+ Assert.NotNull(vm.CurrentProject.Product.PublicKey);
+ Assert.NotNull(vm.CurrentProject.Product.PrivateKey);
+ Assert.Contains("<P>", vm.CurrentProject.Product.PrivateKey); //Makes sure it is only private
+ Assert.Contains("<Modulus>", vm.CurrentProject.Product.PublicKey); //Makes sure it is public
+ }
+
+ private ProjectViewModel CreateViewModel()
+ {
+ return new ProjectViewModel(_projectService, _dialogService);
+ }
}
}
View
33 Rhino.Licensing.AdminTool.Tests/ViewModels/ShellViewModelTests.cs
@@ -1,11 +1,12 @@
using Caliburn.PresentationFramework.ApplicationModel;
+using Caliburn.PresentationFramework.Screens;
using Caliburn.Testability;
using Rhino.Licensing.AdminTool.Factories;
+using Rhino.Licensing.AdminTool.Services;
using Rhino.Licensing.AdminTool.ViewModels;
using Rhino.Licensing.AdminTool.Views;
using Rhino.Mocks;
using Xunit;
-using IViewModelFactory = Caliburn.PresentationFramework.ViewModels.IViewModelFactory;
namespace Rhino.Licensing.AdminTool.Tests.ViewModels
{
@@ -13,13 +14,16 @@ public class ShellViewModelTests
{
private readonly IViewModelFactory _viewModelFactory;
private readonly IWindowManager _windowManager;
- private readonly IProjectFactory _projectFactory;
+ private readonly IProjectService _projectService;
+ private readonly IDialogService _dialogService;
+
public ShellViewModelTests()
{
_viewModelFactory = MockRepository.GenerateMock<IViewModelFactory>();
_windowManager = MockRepository.GenerateMock<IWindowManager>();
- _projectFactory = MockRepository.GenerateMock<IProjectFactory>();
+ _projectService = MockRepository.GenerateMock<IProjectService>();
+ _dialogService = MockRepository.GenerateMock<IDialogService>();
}
[Fact]
@@ -48,9 +52,8 @@ public void ShowAbout_Action_Displays_Dialog()
[Fact]
public void CreateNewProject_Opens_ProjectViewModel()
{
-
var shell = CreateShellViewModel();
- var vm = new ProjectViewModel();
+ var vm = CreateProjectViewModel();
_viewModelFactory.Expect(x => x.Create<ProjectViewModel>()).Return(vm);
@@ -60,9 +63,27 @@ public void CreateNewProject_Opens_ProjectViewModel()
Assert.Equal(vm, shell.ActiveItem);
}
+ [Fact]
+ public void Opening_New_Screen_Will_Destroy_Previous()
+ {
+ var shell = CreateShellViewModel();
+ var vm = CreateProjectViewModel();
+
+ shell.ActiveItem = vm; //Set initial view
+
+ shell.ActiveItem = new Screen(); //Change to new view
+
+ _viewModelFactory.AssertWasCalled(x => x.Release(Arg.Is(vm)));
+ }
+
+ private ProjectViewModel CreateProjectViewModel()
+ {
+ return new ProjectViewModel(_projectService, _dialogService);
+ }
+
private ShellViewModel CreateShellViewModel()
{
- return new ShellViewModel(_windowManager, _viewModelFactory, _projectFactory);
+ return new ShellViewModel(_windowManager, _viewModelFactory, _projectService);
}
}
}
View
13 Rhino.Licensing.AdminTool/App.xaml
@@ -13,5 +13,18 @@
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
+ <Style x:Key="ToolButton" TargetType="{x:Type ButtonBase}">
+ <Setter Property="Width" Value="25"/>
+ <Setter Property="Height" Value="25"/>
+ <Setter Property="Margin" Value="1"/>
+ </Style>
+
+ <Style x:Key="ToolSeparator" TargetType="{x:Type Rectangle}">
+ <Setter Property="Height" Value="25"/>
+ <Setter Property="Width" Value="2"/>
+ <Setter Property="Margin" Value="2"/>
+ <Setter Property="Fill" Value="Gray"/>
+ </Style>
+
</Application.Resources>
</Application>
View
51 Rhino.Licensing.AdminTool/Dialogs/FileDialog.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Windows.Forms;
+using Rhino.Licensing.AdminTool.ViewModels;
+
+namespace Rhino.Licensing.AdminTool.Dialogs
+{
+ public abstract class FileDialog : IDisposable
+ {
+ public DialogResult ShowDialog()
+ {
+ var result = Dialog.ShowDialog();
+
+ ViewModel.FileName = Dialog.FileName;
+ ViewModel.FileNames = Dialog.FileNames;
+
+ return result;
+ }
+
+ protected abstract System.Windows.Forms.FileDialog Dialog
+ {
+ get;
+ }
+
+ public abstract IFileDialogViewModel ViewModel
+ {
+ get;
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ ~FileDialog()
+ {
+ Dispose(false);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (Dialog != null)
+ {
+ Dialog.Dispose();
+ }
+ }
+ }
+ }
+}
View
38 Rhino.Licensing.AdminTool/Dialogs/OpenFileDialog.cs
@@ -0,0 +1,38 @@
+using Rhino.Licensing.AdminTool.ViewModels;
+using OpenDialog = System.Windows.Forms.OpenFileDialog;
+
+namespace Rhino.Licensing.AdminTool.Dialogs
+{
+ public class OpenFileDialog : FileDialog
+ {
+ private readonly OpenDialog _openFileDialog;
+ private readonly IOpenFileDialogViewModel _viewModel;
+
+ public OpenFileDialog(IOpenFileDialogViewModel viewModel)
+ {
+ _viewModel = viewModel;
+ _openFileDialog = new OpenDialog
+ {
+ AddExtension = viewModel.AddExtension,
+ CheckFileExists = viewModel.CheckFileExists,
+ CheckPathExists = viewModel.CheckPathExists,
+ DefaultExt = viewModel.DefaultExtension,
+ FileName = viewModel.FileName,
+ Filter = viewModel.Filter,
+ InitialDirectory = viewModel.InitialDirectory,
+ Multiselect = viewModel.MultiSelect,
+ Title = viewModel.Title
+ };
+ }
+
+ protected override System.Windows.Forms.FileDialog Dialog
+ {
+ get { return _openFileDialog; }
+ }
+
+ public override IFileDialogViewModel ViewModel
+ {
+ get { return _viewModel; }
+ }
+ }
+}
View
41 Rhino.Licensing.AdminTool/Dialogs/SaveFileDialog.cs
@@ -0,0 +1,41 @@
+using Rhino.Licensing.AdminTool.ViewModels;
+using SaveDialog = System.Windows.Forms.SaveFileDialog;
+
+
+namespace Rhino.Licensing.AdminTool.Dialogs
+{
+ public class SaveFileDialog : FileDialog
+ {
+ private readonly ISaveFileDialogViewModel _viewModel;
+ private readonly SaveDialog _dialog;
+
+ public SaveFileDialog(ISaveFileDialogViewModel viewModel)
+ {
+ _viewModel = viewModel;
+ _dialog = new SaveDialog
+ {
+ AddExtension = viewModel.AddExtension,
+ CheckFileExists = viewModel.CheckFileExists,
+ CheckPathExists = viewModel.CheckPathExists,
+ DefaultExt = viewModel.DefaultExtension,
+ FileName = viewModel.FileName,
+ Filter = viewModel.Filter,
+ InitialDirectory = viewModel.InitialDirectory,
+ Title = viewModel.Title,
+ AutoUpgradeEnabled = true,
+ OverwritePrompt = viewModel.OverwritePrompt,
+ SupportMultiDottedExtensions = viewModel.SupportMultiDottedExtensions,
+ };
+ }
+
+ protected override System.Windows.Forms.FileDialog Dialog
+ {
+ get { return _dialog; }
+ }
+
+ public override IFileDialogViewModel ViewModel
+ {
+ get { return _viewModel; }
+ }
+ }
+}
View
8 Rhino.Licensing.AdminTool/Extensions/ReflectionExtensions.cs
@@ -5,7 +5,13 @@ namespace Rhino.Licensing.AdminTool.Extensions
{
public static class ReflectionExtensions
{
- public static T GetAttribute<T>(this ICustomAttributeProvider attributeProvider, bool inherit = true)
+ public static T GetAttribute<T>(this ICustomAttributeProvider attributeProvider)
+ where T : Attribute
+ {
+ return GetAttribute<T>(attributeProvider, true);
+ }
+
+ public static T GetAttribute<T>(this ICustomAttributeProvider attributeProvider, bool inherit)
where T : Attribute
{
var attribs = attributeProvider.GetCustomAttributes(typeof (T), inherit);
View
15 Rhino.Licensing.AdminTool/Extensions/StringExtensions.cs
@@ -0,0 +1,15 @@
+namespace Rhino.Licensing.AdminTool.Extensions
+{
+ public static class StringExtensions
+ {
+ public static bool IsNotEmpty(this string value)
+ {
+ return !string.IsNullOrEmpty(value);
+ }
+
+ public static bool IsEmpty(this string value)
+ {
+ return string.IsNullOrEmpty(value);
+ }
+ }
+}
View
22 Rhino.Licensing.AdminTool/Factories/IDialogFactory.cs
@@ -0,0 +1,22 @@
+using Rhino.Licensing.AdminTool.Dialogs;
+using Rhino.Licensing.AdminTool.ViewModels;
+
+namespace Rhino.Licensing.AdminTool.Factories
+{
+ public interface IDialogFactory
+ {
+ /// <summary>
+ /// Creates a new FileDialog
+ /// </summary>
+ /// <param name="dialogModel"></param>
+ /// <typeparam name="T"></typeparam>
+ /// <returns></returns>
+ T Create<T>(IFileDialogViewModel dialogModel) where T : FileDialog;
+
+ /// <summary>
+ /// Releases file dialog for garbage collection
+ /// </summary>
+ /// <param name="dialog"></param>
+ void Release(FileDialog dialog);
+ }
+}
View
8 ...g.AdminTool/Factories/ViewModelFactory.cs → ....AdminTool/Factories/IViewModelFactory.cs
@@ -1,3 +1,5 @@
+using Caliburn.PresentationFramework.Screens;
+
namespace Rhino.Licensing.AdminTool.Factories
{
public interface IViewModelFactory
@@ -8,14 +10,14 @@ public interface IViewModelFactory
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
- T Create<T>();
+ T Create<T>() where T : IScreen;
/// <summary>
- /// Destroys a view model and release
+ /// Releases a view model and release
/// it for garbage collection
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="viewModel"></param>
- void Destroy<T>(T viewModel);
+ void Release(IScreen viewModel);
}
}
View
1  Rhino.Licensing.AdminTool/Model/Product.cs
@@ -3,6 +3,7 @@
namespace Rhino.Licensing.AdminTool.Model
{
+ [Serializable]
public class Product : PropertyChangedBase
{
private string _publicKey;
View
2  Rhino.Licensing.AdminTool/Model/Project.cs
@@ -1,7 +1,9 @@
+using System;
using Caliburn.PresentationFramework;
namespace Rhino.Licensing.AdminTool.Model
{
+ [Serializable]
public class Project : PropertyChangedBase
{
private string _name;
View
53 Rhino.Licensing.AdminTool/Rhino.Licensing.AdminTool.csproj
@@ -16,6 +16,21 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
@@ -78,6 +93,8 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Data" />
+ <Reference Include="System.Security" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -93,19 +110,28 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Dialogs\FileDialog.cs" />
+ <Compile Include="Dialogs\OpenFileDialog.cs" />
+ <Compile Include="Dialogs\SaveFileDialog.cs" />
<Compile Include="Extensions\ContainerExtensions.cs" />
<Compile Include="Extensions\ReflectionExtensions.cs" />
- <Compile Include="Factories\ProjectFactory.cs" />
- <Compile Include="Factories\ViewModelFactory.cs" />
+ <Compile Include="Extensions\StringExtensions.cs" />
+ <Compile Include="Factories\IDialogFactory.cs" />
+ <Compile Include="Factories\IViewModelFactory.cs" />
<Compile Include="Model\Product.cs" />
<Compile Include="Model\Project.cs" />
+ <Compile Include="Services\DialogService.cs" />
+ <Compile Include="Services\ProjectService.cs" />
+ <Compile Include="Startup\FactoryRegistration.cs" />
<Compile Include="Startup\GuyWire.cs" />
<Compile Include="Startup\ServiceRegistration.cs" />
<Compile Include="Startup\ViewModelRegistration.cs" />
<Compile Include="Startup\ViewRegistration.cs" />
<Compile Include="ViewModels\AboutViewModel.cs" />
- <Compile Include="ViewModels\IViewModel.cs" />
+ <Compile Include="ViewModels\FileDialogViewModel.cs" />
+ <Compile Include="ViewModels\OpenFileDialogViewModel.cs" />
<Compile Include="ViewModels\ProjectViewModel.cs" />
+ <Compile Include="ViewModels\SaveFileDialogViewModel.cs" />
<Compile Include="ViewModels\ShellViewModel.cs" />
<Compile Include="Views\AboutView.xaml.cs">
<DependentUpon>AboutView.xaml</DependentUpon>
@@ -141,9 +167,7 @@
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
- <ItemGroup>
- <Folder Include="Services\" />
- </ItemGroup>
+ <ItemGroup />
<ItemGroup>
<Page Include="Views\AboutView.xaml">
<SubType>Designer</SubType>
@@ -158,6 +182,23 @@
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
View
70 Rhino.Licensing.AdminTool/Services/DialogService.cs
@@ -0,0 +1,70 @@
+using System.Windows.Forms;
+using Rhino.Licensing.AdminTool.Factories;
+using Rhino.Licensing.AdminTool.ViewModels;
+using OpenFileDialog = Rhino.Licensing.AdminTool.Dialogs.OpenFileDialog;
+using SaveFileDialog = Rhino.Licensing.AdminTool.Dialogs.SaveFileDialog;
+
+namespace Rhino.Licensing.AdminTool.Services
+{
+ public interface IDialogService
+ {
+ /// <summary>
+ /// Shows a OpenFileDialog
+ /// </summary>
+ /// <param name="dialogModel"></param>
+ /// <returns></returns>
+ bool? ShowOpenFileDialog(IOpenFileDialogViewModel dialogModel);
+
+ /// <summary>
+ /// Shows a SaveFileDialog
+ /// </summary>
+ /// <param name="dialogModel"></param>
+ /// <returns></returns>
+ bool? ShowSaveFileDialog(ISaveFileDialogViewModel dialogModel);
+ }
+
+ public class DialogService : IDialogService
+ {
+ private readonly IDialogFactory _dialogFactory;
+
+ public DialogService(IDialogFactory dialogFactory)
+ {
+ _dialogFactory = dialogFactory;
+ }
+
+ public bool? ShowOpenFileDialog(IOpenFileDialogViewModel dialogModel)
+ {
+ var dialog = _dialogFactory.Create<OpenFileDialog>(dialogModel);
+ var result = dialog.ShowDialog();
+
+ _dialogFactory.Release(dialog);
+
+ return MappedResult(result);
+ }
+
+ public bool? ShowSaveFileDialog(ISaveFileDialogViewModel dialogModel)
+ {
+ var dialog = _dialogFactory.Create<SaveFileDialog>(dialogModel);
+ var result = dialog.ShowDialog();
+
+ _dialogFactory.Release(dialog);
+
+ return MappedResult(result);
+ }
+
+ private static bool? MappedResult(DialogResult result)
+ {
+ if (result == DialogResult.OK)
+ {
+ return true;
+ }
+
+ if (result == DialogResult.Cancel)
+ {
+ return false;
+ }
+
+ return null;
+ }
+ }
+}
View
24 ...ing.AdminTool/Factories/ProjectFactory.cs → ...sing.AdminTool/Services/ProjectService.cs
@@ -2,27 +2,24 @@
using System.IO;
using Rhino.Licensing.AdminTool.Model;
-namespace Rhino.Licensing.AdminTool.Factories
+namespace Rhino.Licensing.AdminTool.Services
{
- public interface IProjectFactory
+ public interface IProjectService
{
- /// <summary>
- /// Creates a new project
- /// </summary>
- /// <returns></returns>
+ void Save(Project project);
+
Project Create();
- /// <summary>
- /// Loads a project object from
- /// specified file
- /// </summary>
- /// <param name="file"></param>
- /// <returns></returns>
Project Load(FileInfo file);
}
- public class ProjectFactory : IProjectFactory
+ public class ProjectService : IProjectService
{
+ public void Save(Project project)
+ {
+
+ }
+
public Project Create()
{
return new Project()
@@ -40,5 +37,6 @@ public Project Load(FileInfo file)
{
return null;
}
+
}
}
View
22 Rhino.Licensing.AdminTool/Startup/FactoryRegistration.cs
@@ -0,0 +1,22 @@
+using Castle.MicroKernel;
+using Castle.MicroKernel.Registration;
+using Rhino.Licensing.AdminTool.Extensions;
+using Rhino.Licensing.AdminTool.Factories;
+using Castle.Facilities.TypedFactory;
+
+namespace Rhino.Licensing.AdminTool.Startup
+{
+ public class FactoryRegistration : IRegistration
+ {
+ public void Register(IKernel kernel)
+ {
+ kernel.AddFacility<TypedFactoryFacility>();
+
+ kernel.Register(Component.For<IViewModelFactory>().AsFactory());
+
+ kernel.Register(AllTypes.FromAssemblyContaining<ViewModelRegistration>()
+ .Where(t => t.Namespace == "Rhino.Licensing.AdminTool.Factories")
+ .WithService.FirstInterfaceOnClass());
+ }
+ }
+}
View
4 Rhino.Licensing.AdminTool/Startup/GuyWire.cs
@@ -37,6 +37,8 @@ public virtual IEnumerable<IRegistration> ComponentsInfo
{
yield return new ViewRegistration();
yield return new ViewModelRegistration();
+ yield return new FactoryRegistration();
+ yield return new ServiceRegistration();
}
}
@@ -68,7 +70,7 @@ public virtual void Dewire()
/// </summary>
public virtual void ShowRootModel()
{
- var root = Container.Resolve<ShellViewModel>();
+ var root = Container.Resolve<IShellViewModel>();
var windowManager = Container.Resolve<IWindowManager>();
windowManager.Show(root, null);
View
2  Rhino.Licensing.AdminTool/Startup/ViewModelRegistration.cs
@@ -14,7 +14,7 @@ public void Register(IKernel kernel)
.Where(t => t.Namespace == "Rhino.Licensing.AdminTool.ViewModels")
.WithService.FirstInterfaceOnClass()
.Configure(c => c.LifeStyle.Transient)
- .ConfigureFor<ShellViewModel>(c => c.LifeStyle.Singleton));
+ .ConfigureFor<IShellViewModel>(c => c.LifeStyle.Singleton));
}
}
}
View
122 Rhino.Licensing.AdminTool/ViewModels/FileDialogViewModel.cs
@@ -0,0 +1,122 @@
+using System.Collections.Generic;
+using Caliburn.PresentationFramework.Screens;
+
+namespace Rhino.Licensing.AdminTool.ViewModels
+{
+ public interface IFileDialogViewModel
+ {
+ bool AddExtension { get; set; }
+ bool CheckFileExists { get; set; }
+ bool CheckPathExists { get; set; }
+ string DefaultExtension { get; set; }
+ string FileName { get; set; }
+ string Filter { get; set; }
+ string InitialDirectory { get; set; }
+ string Title { get; set; }
+ string DisplayName { get; set; }
+ IEnumerable<string> FileNames { get; set; }
+ }
+
+ public abstract class FileDialogViewModel : Screen, IFileDialogViewModel
+ {
+ private bool _addExtension;
+ private bool _checkFileExists;
+ private bool _checkPathExists;
+ private string _defaultExtension;
+ private string _fileName;
+ private IEnumerable<string > _fileNames;
+ private string _filter;
+ private string _initialDirectory;
+ private string _title;
+
+ public virtual bool AddExtension
+ {
+ get { return _addExtension; }
+ set
+ {
+ _addExtension = value;
+ NotifyOfPropertyChange(() => AddExtension);
+ }
+ }
+
+ public virtual bool CheckFileExists
+ {
+ get { return _checkFileExists; }
+ set
+ {
+ _checkFileExists = value;
+ NotifyOfPropertyChange(() => CheckFileExists);
+ }
+ }
+
+ public virtual bool CheckPathExists
+ {
+ get { return _checkPathExists; }
+ set
+ {
+ _checkPathExists = value;
+ NotifyOfPropertyChange(() => CheckPathExists);
+ }
+ }
+
+ public virtual string DefaultExtension
+ {
+ get { return _defaultExtension; }
+ set
+ {
+ _defaultExtension = value;
+ NotifyOfPropertyChange(() => DefaultExtension);
+ }
+ }
+
+ public virtual string FileName
+ {
+ get { return _fileName; }
+ set
+ {
+ _fileName = value;
+ NotifyOfPropertyChange(() => FileName);
+ }
+ }
+
+ public virtual IEnumerable<string> FileNames
+ {
+ get { return _fileNames; }
+ set
+ {
+ _fileNames = value;
+ NotifyOfPropertyChange(() => FileNames);
+ }
+ }
+
+ public virtual string Filter
+ {
+ get { return _filter; }
+ set
+ {
+ _filter = value;
+ NotifyOfPropertyChange(() => Filter);
+ }
+ }
+
+ public virtual string InitialDirectory
+ {
+ get { return _initialDirectory; }
+ set
+ {
+ _initialDirectory = value;
+ NotifyOfPropertyChange(() => InitialDirectory);
+ }
+ }
+
+ public virtual string Title
+ {
+ get { return _title; }
+ set
+ {
+ _title = value;
+ NotifyOfPropertyChange(() => Title);
+ }
+ }
+ }
+}
View
7 Rhino.Licensing.AdminTool/ViewModels/IViewModel.cs
@@ -1,7 +0,0 @@
-namespace Rhino.Licensing.AdminTool.ViewModels
-{
- public interface IViewModel
- {
-
- }
-}
View
22 Rhino.Licensing.AdminTool/ViewModels/OpenFileDialogViewModel.cs
@@ -0,0 +1,22 @@
+namespace Rhino.Licensing.AdminTool.ViewModels
+{
+ public interface IOpenFileDialogViewModel : IFileDialogViewModel
+ {
+ bool MultiSelect { get; set; }
+ }
+
+ public class OpenFileDialogViewModel : FileDialogViewModel, IOpenFileDialogViewModel
+ {
+ private bool _multiSelect;
+
+ public virtual bool MultiSelect
+ {
+ get { return _multiSelect; }
+ set
+ {
+ _multiSelect = value;
+ NotifyOfPropertyChange(() => MultiSelect);
+ }
+ }
+ }
+}
View
46 Rhino.Licensing.AdminTool/ViewModels/ProjectViewModel.cs
@@ -1,11 +1,26 @@
+using System.Security.Cryptography;
+using Caliburn.PresentationFramework.Filters;
using Caliburn.PresentationFramework.Screens;
+using Rhino.Licensing.AdminTool.Extensions;
+using Rhino.Licensing.AdminTool.Factories;
using Rhino.Licensing.AdminTool.Model;
+using Rhino.Licensing.AdminTool.Services;
namespace Rhino.Licensing.AdminTool.ViewModels
{
public class ProjectViewModel : Screen
{
private Project _project;
+ private readonly IProjectService _projectService;
+ private readonly IDialogService _dialogService;
+
+ public ProjectViewModel(
+ IProjectService projectService,
+ IDialogService dialogService)
+ {
+ _projectService = projectService;
+ _dialogService = dialogService;
+ }
public virtual Project CurrentProject
{
@@ -16,5 +31,36 @@ public virtual Project CurrentProject
NotifyOfPropertyChange(() => CurrentProject);
}
}
+
+ public virtual void GenerateKey()
+ {
+ var key = RSA.Create();
+
+ CurrentProject.Product.PublicKey = key.ToXmlString(false);
+ CurrentProject.Product.PrivateKey = key.ToXmlString(true);
+ }
+
+ public virtual bool CanSave()
+ {
+ return CurrentProject.Product != null &&
+ CurrentProject.Product.Name.IsNotEmpty();
+ }
+
+ [AutoCheckAvailability]
+ public virtual void Save()
+ {
+ var dialog = new SaveFileDialogViewModel();
+ var result = _dialogService.ShowSaveFileDialog(dialog);
+
+ if (result.GetValueOrDefault(false))
+ {
+ _projectService.Save(CurrentProject);
+ }
+ }
+
+ public override void TryClose(bool? dialogResult)
+ {
+ base.TryClose(dialogResult);
+ }
}
}
View
34 Rhino.Licensing.AdminTool/ViewModels/SaveFileDialogViewModel.cs
@@ -0,0 +1,34 @@
+namespace Rhino.Licensing.AdminTool.ViewModels
+{
+ public interface ISaveFileDialogViewModel : IFileDialogViewModel
+ {
+ bool OverwritePrompt { get; set; }
+ bool SupportMultiDottedExtensions { get; set; }
+ }
+
+ public class SaveFileDialogViewModel : FileDialogViewModel, ISaveFileDialogViewModel
+ {
+ private bool _overwritePrompt;
+ private bool _supportMultiDottedExtensions;
+
+ public bool OverwritePrompt
+ {
+ get { return _overwritePrompt; }
+ set
+ {
+ _overwritePrompt = value;
+ NotifyOfPropertyChange(() => OverwritePrompt);
+ }
+ }
+
+ public bool SupportMultiDottedExtensions
+ {
+ get { return _supportMultiDottedExtensions; }
+ set
+ {
+ _supportMultiDottedExtensions = value;
+ NotifyOfPropertyChange(() => SupportMultiDottedExtensions);
+ }
+ }
+ }
+}
View
32 Rhino.Licensing.AdminTool/ViewModels/ShellViewModel.cs
@@ -1,30 +1,50 @@
using Caliburn.PresentationFramework.ApplicationModel;
using Caliburn.PresentationFramework.Screens;
using Rhino.Licensing.AdminTool.Factories;
-using IViewModelFactory = Caliburn.PresentationFramework.ViewModels.IViewModelFactory;
+using Rhino.Licensing.AdminTool.Services;
namespace Rhino.Licensing.AdminTool.ViewModels
{
- public class ShellViewModel : Conductor<Screen>.Collection.OneActive
+ public interface IShellViewModel : IConductor
+ {
+ /// <summary>
+ /// Shows about dialog
+ /// </summary>
+ void ShowAboutDialog();
+
+ /// <summary>
+ /// Shows Project view model and
+ /// create a new project
+ /// </summary>
+ void CreateNewProject();
+ }
+
+ public class ShellViewModel : Conductor<Screen>, IShellViewModel
{
private readonly IViewModelFactory _viewModelFactory;
- private readonly IProjectFactory _projectFactory;
+ private readonly IProjectService _projectService;
private readonly IWindowManager _windowManager;
public ShellViewModel(
IWindowManager windowManager,
IViewModelFactory viewModelFactory,
- IProjectFactory projectFactory)
+ IProjectService projectService)
{
DisplayName = "Rhino.Licensing.AdminTool";
_windowManager = windowManager;
_viewModelFactory = viewModelFactory;
- _projectFactory = projectFactory;
+ _projectService = projectService;
}
protected override void ChangeActiveItem(Screen newItem, bool closePrevious)
{
+ var oldViewModel = ActiveItem;
+ if(oldViewModel != null)
+ {
+ _viewModelFactory.Release(oldViewModel);
+ }
+
base.ChangeActiveItem(newItem, closePrevious);
}
@@ -36,7 +56,7 @@ public virtual void ShowAboutDialog()
public virtual void CreateNewProject()
{
var vm = _viewModelFactory.Create<ProjectViewModel>();
- var project = _projectFactory.Create();
+ var project = _projectService.Create();
vm.CurrentProject = project;
ActiveItem = vm;
View
6 Rhino.Licensing.AdminTool/Views/AboutView.xaml.cs
@@ -1,9 +1,13 @@
namespace Rhino.Licensing.AdminTool.Views
{
+ public interface IAboutView
+ {
+ }
+
/// <summary>
/// Interaction logic for AboutView.xaml
/// </summary>
- public partial class AboutView
+ public partial class AboutView : IAboutView
{
public AboutView()
{
View
50 Rhino.Licensing.AdminTool/Views/ProjectView.xaml
@@ -3,17 +3,38 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
- d:DesignHeight="300" d:DesignWidth="300">
+ d:DesignHeight="300" d:DesignWidth="300" Padding="5">
- <StackPanel Orientation="Vertical">
+ <DockPanel LastChildFill="True">
+
+ <ToolBarPanel DockPanel.Dock="Top"
+ HorizontalAlignment="Left"
+ Orientation="Horizontal">
+
+ <Button Style="{StaticResource ToolButton}"
+ Content="Save"
+ cal:Message.Attach="[Event Click]=[Action Save]"/>
+
+ <Button Style="{StaticResource ToolButton}"
+ Content="Close"
+ cal:Message.Attach="[Event Click]=[Action TryClose]"/>
+
+ <Rectangle Style="{StaticResource ToolSeparator}" />
+
+ <Button Style="{StaticResource ToolButton}"
+ Content="Generate Key Pair"
+ cal:Message.Attach="[Event Click]=[Action GenerateKey]"/>
+
+ </ToolBarPanel>
<GroupBox Header="Product Information" Margin="5">
<Grid>
<Grid.RowDefinitions>
- <RowDefinition/>
- <RowDefinition/>
- <RowDefinition/>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="2*"/>
+ <RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@@ -23,22 +44,25 @@
<TextBlock Style="{StaticResource Label}" Text="Name: " Grid.Column="0" Grid.Row="0" />
<TextBlock Style="{StaticResource Label}" Text="Public Key: " Grid.Column="0" Grid.Row="1"/>
<TextBlock Style="{StaticResource Label}" Text="Private Key: " Grid.Column="0" Grid.Row="2"/>
-
- <TextBox Text="{Binding Project.Name}"
+
+ <TextBox Text="{Binding Path=CurrentProject.Product.Name}"
Grid.Column="1" Grid.Row="0" />
-
- <TextBox Text="{Binding Project.PublicKey}"
+
+ <TextBox Text="{Binding Path=CurrentProject.Product.PublicKey}"
IsReadOnly="True"
+ TextWrapping="WrapWithOverflow"
+ ScrollViewer.VerticalScrollBarVisibility="Auto"
Grid.Column="1" Grid.Row="1" />
-
- <TextBox Text="{Binding Project.PrivateKey}"
+
+ <TextBox Text="{Binding Path=CurrentProject.Product.PrivateKey}"
IsReadOnly="True"
+ TextWrapping="WrapWithOverflow"
+ ScrollViewer.VerticalScrollBarVisibility="Auto"
Grid.Column="1" Grid.Row="2" />
-
</Grid>
</GroupBox>
- </StackPanel>
+ </DockPanel>
</UserControl>
View
6 Rhino.Licensing.AdminTool/Views/ProjectView.xaml.cs
@@ -1,9 +1,13 @@
namespace Rhino.Licensing.AdminTool.Views
{
+ public interface IProjectView
+ {
+ }
+
/// <summary>
/// Interaction logic for ProjectView.xaml
/// </summary>
- public partial class ProjectView
+ public partial class ProjectView : IProjectView
{
public ProjectView()
{
View
6 Rhino.Licensing.AdminTool/Views/ShellView.xaml.cs
@@ -1,9 +1,13 @@
namespace Rhino.Licensing.AdminTool.Views
{
+ public interface IShellView
+ {
+ }
+
/// <summary>
/// Interaction logic for ShellView.xaml
/// </summary>
- public partial class ShellView
+ public partial class ShellView : IShellView
{
public ShellView()
{
View
4 Rhino.Licensing.Tests/Can_check_trial_date.cs
@@ -9,7 +9,7 @@ public class Can_check_trial_date : BaseLicenseTest
public void Will_tell_that_we_are_in_invalid_state()
{
var validator = new LicenseValidator(public_only, Path.GetTempFileName());
- Assert.Throws<LicenseNotFoundException>(validator.AssertValidLicense);
+ Assert.Throws<LicenseNotFoundException>(() => validator.AssertValidLicense());
}
@@ -17,7 +17,7 @@ public void Will_tell_that_we_are_in_invalid_state()
public void Will_fail_if_file_is_not_there()
{
var validator = new LicenseValidator(public_only, "not_there");
- Assert.Throws<LicenseFileNotFoundException>(validator.AssertValidLicense);
+ Assert.Throws<LicenseFileNotFoundException>(() => validator.AssertValidLicense());
}
}
}
View
2  Rhino.Licensing.Tests/Can_generate_and_validate_key.cs
@@ -81,7 +81,7 @@ public void Cannot_validate_hacked_license()
File.WriteAllText(path, hackedLicense);
var validator = new LicenseValidator(public_only, path);
- Assert.Throws<LicenseNotFoundException>(validator.AssertValidLicense);
+ Assert.Throws<LicenseNotFoundException>(() => validator.AssertValidLicense());
}
}
}
View
2  Rhino.Licensing.Tests/Can_use_floating_licenses.cs
@@ -84,7 +84,7 @@ public void Can_only_get_license_per_allocated_licenses()
validator.AssertValidLicense();
var validator2 = new LicenseValidator(public_only, fileName, address, Guid.NewGuid());
- Assert.Throws<FloatingLicenseNotAvialableException>(validator2.AssertValidLicense);
+ Assert.Throws<FloatingLicenseNotAvialableException>(() => validator2.AssertValidLicense());
}
finally
{
View
3  Rhino.Licensing.Tests/Rhino.Licensing.Tests.csproj
@@ -50,8 +50,7 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="xunit, Version=1.1.0.1323, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
+ <Reference Include="xunit">
<HintPath>..\SharedLibs\xunit.dll</HintPath>
</Reference>
</ItemGroup>
View
2  Rhino.Licensing/Rhino.Licensing.csproj
@@ -33,6 +33,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -43,6 +44,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1607</NoWarn>
+ <DocumentationFile>bin\Debug\Rhino.Licensing.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
View
BIN  SharedLibs/xunit.dll
Binary file not shown
View
742 SharedLibs/xunit.xml
@@ -22,7 +22,7 @@
<typeparam name="T">The type of the object to be verified</typeparam>
<param name="expected">The object expected to be in the collection</param>
<param name="collection">The collection to be inspected</param>
- <exception cref="T:Xunit.ContainsException">Thrown when the object is not present in the collection</exception>
+ <exception cref="T:Xunit.Sdk.ContainsException">Thrown when the object is not present in the collection</exception>
</member>
<member name="M:Xunit.Assert.Contains``1(``0,System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IComparer{``0})">
<summary>
@@ -32,7 +32,7 @@
<param name="expected">The object expected to be in the collection</param>
<param name="collection">The collection to be inspected</param>
<param name="comparer">The comparer used to equate objects in the collection with the expected object</param>
- <exception cref="T:Xunit.ContainsException">Thrown when the object is not present in the collection</exception>
+ <exception cref="T:Xunit.Sdk.ContainsException">Thrown when the object is not present in the collection</exception>
</member>
<member name="M:Xunit.Assert.Contains(System.String,System.String)">
<summary>
@@ -40,7 +40,7 @@
</summary>
<param name="expectedSubString">The sub-string expected to be in the string</param>
<param name="actualString">The string to be inspected</param>
- <exception cref="T:Xunit.ContainsException">Thrown when the sub-string is not present inside the string</exception>
+ <exception cref="T:Xunit.Sdk.ContainsException">Thrown when the sub-string is not present inside the string</exception>
</member>
<member name="M:Xunit.Assert.Contains(System.String,System.String,System.StringComparison)">
<summary>
@@ -49,7 +49,7 @@
<param name="expectedSubString">The sub-string expected to be in the string</param>
<param name="actualString">The string to be inspected</param>
<param name="comparisonType">The type of string comparison to perform</param>
- <exception cref="T:Xunit.ContainsException">Thrown when the sub-string is not present inside the string</exception>
+ <exception cref="T:Xunit.Sdk.ContainsException">Thrown when the sub-string is not present inside the string</exception>
</member>
<member name="M:Xunit.Assert.DoesNotContain``1(``0,System.Collections.Generic.IEnumerable{``0})">
<summary>
@@ -58,7 +58,7 @@
<typeparam name="T">The type of the object to be compared</typeparam>
<param name="expected">The object that is expected not to be in the collection</param>
<param name="collection">The collection to be inspected</param>
- <exception cref="T:Xunit.DoesNotContainException">Thrown when the object is present inside the container</exception>
+ <exception cref="T:Xunit.Sdk.DoesNotContainException">Thrown when the object is present inside the container</exception>
</member>
<member name="M:Xunit.Assert.DoesNotContain``1(``0,System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IComparer{``0})">
<summary>
@@ -68,7 +68,7 @@
<param name="expected">The object that is expected not to be in the collection</param>
<param name="collection">The collection to be inspected</param>
<param name="comparer">The comparer used to equate objects in the collection with the expected object</param>
- <exception cref="T:Xunit.DoesNotContainException">Thrown when the object is present inside the container</exception>
+ <exception cref="T:Xunit.Sdk.DoesNotContainException">Thrown when the object is present inside the container</exception>
</member>
<member name="M:Xunit.Assert.DoesNotContain(System.String,System.String)">
<summary>
@@ -76,7 +76,7 @@
</summary>
<param name="expectedSubString">The sub-string which is expected not to be in the string</param>
<param name="actualString">The string to be inspected</param>
- <exception cref="T:Xunit.DoesNotContainException">Thrown when the sub-string is present inside the string</exception>
+ <exception cref="T:Xunit.Sdk.DoesNotContainException">Thrown when the sub-string is present inside the string</exception>
</member>
<member name="M:Xunit.Assert.DoesNotContain(System.String,System.String,System.StringComparison)">
<summary>
@@ -85,7 +85,7 @@
<param name="expectedSubString">The sub-string which is expected not to be in the string</param>
<param name="actualString">The string to be inspected</param>
<param name="comparisonType">The type of string comparison to perform</param>
- <exception cref="T:Xunit.DoesNotContainException">Thrown when the sub-string is present inside the given string</exception>
+ <exception cref="T:Xunit.Sdk.DoesNotContainException">Thrown when the sub-string is present inside the given string</exception>
</member>
<member name="M:Xunit.Assert.DoesNotThrow(Xunit.Assert.ThrowsDelegate)">
<summary>
@@ -99,7 +99,7 @@
</summary>
<param name="collection">The collection to be inspected</param>
<exception cref="T:System.ArgumentNullException">Thrown when the collection is null</exception>
- <exception cref="T:Xunit.EmptyException">Thrown when the collection is not empty</exception>
+ <exception cref="T:Xunit.Sdk.EmptyException">Thrown when the collection is not empty</exception>
</member>
<member name="M:Xunit.Assert.Equal``1(``0,``0)">
<summary>
@@ -108,7 +108,7 @@
<typeparam name="T">The type of the objects to be compared</typeparam>
<param name="expected">The expected value</param>
<param name="actual">The value to be compared against</param>
- <exception cref="T:Xunit.EqualException">Thrown when the objects are not equal</exception>
+ <exception cref="T:Xunit.Sdk.EqualException">Thrown when the objects are not equal</exception>
</member>
<member name="M:Xunit.Assert.Equal``1(``0,``0,System.Collections.Generic.IComparer{``0})">
<summary>
@@ -118,7 +118,7 @@
<param name="expected">The expected value</param>
<param name="actual">The value to be compared against</param>
<param name="comparer">The comparer used to compare the two objects</param>
- <exception cref="T:Xunit.EqualException">Thrown when the objects are not equal</exception>
+ <exception cref="T:Xunit.Sdk.EqualException">Thrown when the objects are not equal</exception>
</member>
<member name="M:Xunit.Assert.Equals(System.Object,System.Object)">
<summary>Do not call this method.</summary>
@@ -128,7 +128,7 @@
Verifies that the condition is false.
</summary>
<param name="condition">The condition to be tested</param>
- <exception cref="T:Xunit.FalseException">Thrown if the condition is not false</exception>
+ <exception cref="T:Xunit.Sdk.FalseException">Thrown if the condition is not false</exception>
</member>
<member name="M:Xunit.Assert.False(System.Boolean,System.String)">
<summary>
@@ -136,7 +136,7 @@
</summary>
<param name="condition">The condition to be tested</param>
<param name="userMessage">The message to show when the condition is not false</param>
- <exception cref="T:Xunit.FalseException">Thrown if the condition is not false</exception>
+ <exception cref="T:Xunit.Sdk.FalseException">Thrown if the condition is not false</exception>
</member>
<member name="M:Xunit.Assert.InRange``1(``0,``0,``0)">
<summary>
@@ -146,7 +146,7 @@
<param name="actual">The actual value to be evaluated</param>
<param name="low">The (inclusive) low value of the range</param>
<param name="high">The (inclusive) high value of the range</param>
- <exception cref="T:Xunit.InRangeException">Thrown when the value is not in the given range</exception>
+ <exception cref="T:Xunit.Sdk.InRangeException">Thrown when the value is not in the given range</exception>
</member>
<member name="M:Xunit.Assert.InRange``1(``0,``0,``0,System.Collections.Generic.IComparer{``0})">
<summary>
@@ -157,7 +157,7 @@
<param name="low">The (inclusive) low value of the range</param>
<param name="high">The (inclusive) high value of the range</param>
<param name="comparer">The comparer used to evaluate the value's range</param>
- <exception cref="T:Xunit.InRangeException">Thrown when the value is not in the given range</exception>
+ <exception cref="T:Xunit.Sdk.InRangeException">Thrown when the value is not in the given range</exception>
</member>
<member name="M:Xunit.Assert.IsAssignableFrom``1(System.Object)">
<summary>
@@ -166,7 +166,7 @@
<typeparam name="T">The type the object should be</typeparam>
<param name="object">The object to be evaluated</param>
<returns>The object, casted to type T when successful</returns>
- <exception cref="T:Xunit.IsAssignableFromException">Thrown when the object is not the given type</exception>
+ <exception cref="T:Xunit.Sdk.IsAssignableFromException">Thrown when the object is not the given type</exception>
</member>
<member name="M:Xunit.Assert.IsAssignableFrom(System.Type,System.Object)">
<summary>
@@ -174,7 +174,7 @@
</summary>
<param name="expectedType">The type the object should be</param>
<param name="object">The object to be evaluated</param>
- <exception cref="T:Xunit.IsAssignableFromException">Thrown when the object is not the given type</exception>
+ <exception cref="T:Xunit.Sdk.IsAssignableFromException">Thrown when the object is not the given type</exception>
</member>
<member name="M:Xunit.Assert.IsNotType``1(System.Object)">
<summary>
@@ -182,7 +182,7 @@
</summary>
<typeparam name="T">The type the object should not be</typeparam>
<param name="object">The object to be evaluated</param>
- <exception cref="T:Xunit.IsTypeException">Thrown when the object is the given type</exception>
+ <exception cref="T:Xunit.Sdk.IsNotTypeException">Thrown when the object is the given type</exception>
</member>
<member name="M:Xunit.Assert.IsNotType(System.Type,System.Object)">
<summary>
@@ -190,7 +190,7 @@
</summary>
<param name="expectedType">The type the object should not be</param>
<param name="object">The object to be evaluated</param>
- <exception cref="T:Xunit.IsTypeException">Thrown when the object is the given type</exception>
+ <exception cref="T:Xunit.Sdk.IsNotTypeException">Thrown when the object is the given type</exception>
</member>
<member name="M:Xunit.Assert.IsType``1(System.Object)">
<summary>
@@ -199,7 +199,7 @@
<typeparam name="T">The type the object should be</typeparam>
<param name="object">The object to be evaluated</param>
<returns>The object, casted to type T when successful</returns>
- <exception cref="T:Xunit.IsTypeException">Thrown when the object is not the given type</exception>
+ <exception cref="T:Xunit.Sdk.IsTypeException">Thrown when the object is not the given type</exception>
</member>
<member name="M:Xunit.Assert.IsType(System.Type,System.Object)">
<summary>
@@ -207,7 +207,7 @@
</summary>
<param name="expectedType">The type the object should be</param>
<param name="object">The object to be evaluated</param>
- <exception cref="T:Xunit.IsTypeException">Thrown when the object is not the given type</exception>
+ <exception cref="T:Xunit.Sdk.IsTypeException">Thrown when the object is not the given type</exception>
</member>
<member name="M:Xunit.Assert.NotEmpty(System.Collections.IEnumerable)">
<summary>
@@ -215,7 +215,7 @@
</summary>
<param name="collection">The collection to be inspected</param>
<exception cref="T:System.ArgumentNullException">Thrown when a null collection is passed</exception>
- <exception cref="T:Xunit.NotEmptyException">Thrown when the collection is empty</exception>
+ <exception cref="T:Xunit.Sdk.NotEmptyException">Thrown when the collection is empty</exception>
</member>
<member name="M:Xunit.Assert.NotEqual``1(``0,``0)">
<summary>
@@ -224,7 +224,7 @@
<typeparam name="T">The type of the objects to be compared</typeparam>
<param name="expected">The expected object</param>
<param name="actual">The actual object</param>
- <exception cref="T:Xunit.NotEqualException">Thrown when the objects are equal</exception>
+ <exception cref="T:Xunit.Sdk.NotEqualException">Thrown when the objects are equal</exception>
</member>
<member name="M:Xunit.Assert.NotEqual``1(``0,``0,System.Collections.Generic.IComparer{``0})">
<summary>
@@ -234,7 +234,7 @@
<param name="expected">The expected object</param>
<param name="actual">The actual object</param>
<param name="comparer">The comparer used to examine the objects</param>
- <exception cref="T:Xunit.NotEqualException">Thrown when the objects are equal</exception>
+ <exception cref="T:Xunit.Sdk.NotEqualException">Thrown when the objects are equal</exception>
</member>
<member name="M:Xunit.Assert.NotInRange``1(``0,``0,``0)">
<summary>
@@ -244,7 +244,7 @@
<param name="actual">The actual value to be evaluated</param>
<param name="low">The (inclusive) low value of the range</param>
<param name="high">The (inclusive) high value of the range</param>
- <exception cref="T:Xunit.NotInRangeException">Thrown when the value is in the given range</exception>
+ <exception cref="T:Xunit.Sdk.NotInRangeException">Thrown when the value is in the given range</exception>
</member>
<member name="M:Xunit.Assert.NotInRange``1(``0,``0,``0,System.Collections.Generic.IComparer{``0})">
<summary>
@@ -255,14 +255,14 @@
<param name="low">The (inclusive) low value of the range</param>
<param name="high">The (inclusive) high value of the range</param>
<param name="comparer">The comparer used to evaluate the value's range</param>
- <exception cref="T:Xunit.NotInRangeException">Thrown when the value is in the given range</exception>
+ <exception cref="T:Xunit.Sdk.NotInRangeException">Thrown when the value is in the given range</exception>
</member>
<member name="M:Xunit.Assert.NotNull(System.Object)">
<summary>
Verifies that an object reference is not null.
</summary>
<param name="object">The object to be validated</param>
- <exception cref="T:Xunit.NotNullException">Thrown when the object is not null</exception>
+ <exception cref="T:Xunit.Sdk.NotNullException">Thrown when the object is not null</exception>
</member>
<member name="M:Xunit.Assert.NotSame(System.Object,System.Object)">
<summary>
@@ -270,14 +270,14 @@
</summary>
<param name="expected">The expected object instance</param>
<param name="actual">The actual object instance</param>
- <exception cref="T:Xunit.NotSameException">Thrown when the objects are the same instance</exception>
+ <exception cref="T:Xunit.Sdk.NotSameException">Thrown when the objects are the same instance</exception>
</member>
<member name="M:Xunit.Assert.Null(System.Object)">
<summary>
Verifies that an object reference is null.
</summary>
<param name="object">The object to be inspected</param>
- <exception cref="T:Xunit.NullException">Thrown when the object reference is not null</exception>
+ <exception cref="T:Xunit.Sdk.NullException">Thrown when the object reference is not null</exception>
</member>
<member name="M:Xunit.Assert.Same(System.Object,System.Object)">
<summary>
@@ -285,7 +285,7 @@
</summary>
<param name="expected">The expected object instance</param>
<param name="actual">The actual object instance</param>
- <exception cref="T:Xunit.SameException">Thrown when the objects are not the same instance</exception>
+ <exception cref="T:Xunit.Sdk.SameException">Thrown when the objects are not the same instance</exception>
</member>
<member name="M:Xunit.Assert.Throws``1(Xunit.Assert.ThrowsDelegate)">
<summary>
@@ -294,7 +294,7 @@
<typeparam name="T">The type of the exception expected to be thrown</typeparam>
<param name="testCode">A delegate to the code to be tested</param>
<returns>The exception that was thrown, when successful</returns>
- <exception cref="T:Xunit.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
+ <exception cref="T:Xunit.Sdk.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
</member>
<member name="M:Xunit.Assert.Throws``1(System.String,Xunit.Assert.ThrowsDelegate)">
<summary>
@@ -304,7 +304,28 @@
<param name="userMessage">The message to be shown if the test fails</param>
<param name="testCode">A delegate to the code to be tested</param>
<returns>The exception that was thrown, when successful</returns>
- <exception cref="T:Xunit.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
+ <exception cref="T:Xunit.Sdk.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
+ </member>
+ <member name="M:Xunit.Assert.Throws``1(Xunit.Assert.ThrowsDelegateWithReturn)">
+ <summary>
+ Verifies that the exact exception is thrown (and not a derived exception type).
+ Generally used to test property accessors.
+ </summary>
+ <typeparam name="T">The type of the exception expected to be thrown</typeparam>
+ <param name="testCode">A delegate to the code to be tested</param>
+ <returns>The exception that was thrown, when successful</returns>
+ <exception cref="T:Xunit.Sdk.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
+ </member>
+ <member name="M:Xunit.Assert.Throws``1(System.String,Xunit.Assert.ThrowsDelegateWithReturn)">
+ <summary>
+ Verifies that the exact exception is thrown (and not a derived exception type).
+ Generally used to test property accessors.
+ </summary>
+ <typeparam name="T">The type of the exception expected to be thrown</typeparam>
+ <param name="userMessage">The message to be shown if the test fails</param>
+ <param name="testCode">A delegate to the code to be tested</param>
+ <returns>The exception that was thrown, when successful</returns>
+ <exception cref="T:Xunit.Sdk.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
</member>
<member name="M:Xunit.Assert.Throws(System.Type,Xunit.Assert.ThrowsDelegate)">
<summary>
@@ -313,14 +334,24 @@
<param name="exceptionType">The type of the exception expected to be thrown</param>
<param name="testCode">A delegate to the code to be tested</param>
<returns>The exception that was thrown, when successful</returns>
- <exception cref="T:Xunit.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
+ <exception cref="T:Xunit.Sdk.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
+ </member>
+ <member name="M:Xunit.Assert.Throws(System.Type,Xunit.Assert.ThrowsDelegateWithReturn)">
+ <summary>
+ Verifies that the exact exception is thrown (and not a derived exception type).
+ Generally used to test property accessors.
+ </summary>
+ <param name="exceptionType">The type of the exception expected to be thrown</param>
+ <param name="testCode">A delegate to the code to be tested</param>
+ <returns>The exception that was thrown, when successful</returns>
+ <exception cref="T:Xunit.Sdk.ThrowsException">Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown</exception>
</member>
<member name="M:Xunit.Assert.True(System.Boolean)">
<summary>
Verifies that an expression is true.
</summary>
<param name="condition">The condition to be inspected</param>
- <exception cref="T:Xunit.TrueException">Thrown when the condition is false</exception>
+ <exception cref="T:Xunit.Sdk.TrueException">Thrown when the condition is false</exception>
</member>
<member name="M:Xunit.Assert.True(System.Boolean,System.String)">
<summary>
@@ -328,53 +359,144 @@
</summary>
<param name="condition">The condition to be inspected</param>
<param name="userMessage">The message to be shown when the condition is false</param>
- <exception cref="T:Xunit.TrueException">Thrown when the condition is false</exception>
+ <exception cref="T:Xunit.Sdk.TrueException">Thrown when the condition is false</exception>
</member>
<member name="T:Xunit.Assert.ThrowsDelegate">
<summary>
Used by the Throws and DoesNotThrow methods.
</summary>
</member>
- <member name="T:Xunit.AssertActualExpectedException">
+ <member name="T:Xunit.Assert.ThrowsDelegateWithReturn">
+ <summary>
+ Used by the Throws and DoesNotThrow methods.
+ </summary>
+ </member>
+ <member name="T:Xunit.Sdk.OutputCaptureCommand">
+ <summary>
+ Captures standard output and standard error, and inserts the values into the
+ <see cref="T:Xunit.Sdk.MethodResult"/> as it traverses the chain.
+ </summary>
+ </member>
+ <member name="T:Xunit.Sdk.DelegatingTestCommand">
+ <summary>
+ Base class used by commands which delegate to inner commands.
+ </summary>
+ </member>
+ <member name="T:Xunit.Sdk.ITestCommand">
+ <summary>
+ Interface which represents the ability to invoke of a test method.
+ </summary>
+ </member>
+ <member name="M:Xunit.Sdk.ITestCommand.Execute(System.Object)">
+ <summary>
+ Executes the test method.
+ </summary>
+ <param name="testClass">The instance of the test class</param>
+ <returns>Returns information about the test run</returns>
+ </member>
+ <member name="M:Xunit.Sdk.ITestCommand.ToStartXml">
+ <summary>
+ Creates the start XML to be sent to the callback when the test is about to start
+ running.
+ </summary>
+ <returns>Return the <see cref="T:System.Xml.XmlNode"/> of the start node, or null if the test
+ is known that it will not be running.</returns>
+ </member>
+ <member name="P:Xunit.Sdk.ITestCommand.DisplayName">
+ <summary>
+ Gets the display name of the test method.
+ </summary>
+ </member>
+ <member name="P:Xunit.Sdk.ITestCommand.ShouldCreateInstance">
+ <summary>