Create rudimentary view models, default settings.

This commit is contained in:
Daniel Kraus
2015-07-31 17:19:49 +02:00
parent a725246f27
commit 12cd58180f
21 changed files with 937 additions and 43 deletions

View File

@ -49,12 +49,34 @@ namespace Tests.Controller
Settings s = new Settings();
string testName = "test";
s.Name = testName;
sr.Settings.Add(s);
sr.SettingsList.Add(s);
sr.Store();
sr = null;
sr = SettingsRepository.Load();
Assert.AreEqual(1, sr.Settings.Count);
Assert.AreEqual(testName, sr.Settings[0].Name);
Assert.AreEqual(1, sr.SettingsList.Count);
Assert.AreEqual(testName, sr.SettingsList[0].Name);
}
[Test]
public void CreateDefaultSettings()
{
SettingsRepository sr = new SettingsRepository();
sr.SettingsList.Add(new Settings("test1", null));
sr.SettingsList.Add(new Settings("test2", null));
sr.SettingsList.Add(new Settings("test3", null));
sr.ResetDefault();
// Assert that there are now only the 2 default settings
Assert.AreEqual(2, sr.SettingsList.Count);
Assert.AreEqual(
zaaReloaded2.Properties.Settings.Default.SettingsNameWard,
sr.SettingsList[0].Name,
"Settings for ward expected as #1 (index 0) in list");
Assert.AreEqual(
zaaReloaded2.Properties.Settings.Default.SettingsNameClinic,
sr.SettingsList[1].Name,
"Settings for outpatient clinic expected as #2 (index 1) in list");
}
}
}

View File

@ -41,6 +41,10 @@
<AssemblyOriginatorKeyFile>zaaReloaded2.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Bovender, Version=0.2.0.0, Culture=neutral, PublicKeyToken=df1c15557d8b6df8, processorArchitecture=MSIL">
<HintPath>..\packages\Bovender.0.2.0.0\lib\net40\Bovender.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
@ -48,10 +52,18 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Expression.Blend.Sdk.1.0.2\lib\net40-client\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
@ -79,6 +91,8 @@
<Compile Include="Thesaurus\TestThesaurus.cs" />
<Compile Include="Importer\ZaaImporter\TimePointTest.cs" />
<Compile Include="TestHelpers.cs" />
<Compile Include="ViewModels\SettingsRepositoryViewModel.cs" />
<Compile Include="ViewModels\SettingsViewModelTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@ -0,0 +1,36 @@
/* SettingsRepositoryViewModel.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using zaaReloaded2.Controller;
namespace Tests.ViewModels
{
[TestFixture]
class SettingsRepositoryViewModel
{
[Test]
public void CannotDeleteDefaultSettings()
{
}
}
}

View File

@ -0,0 +1,69 @@
/* SettingsViewModelTest.cs
* part of zaaReloaded2
*
* Copyright 2015 Daniel Kraus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using zaaReloaded2.ViewModels;
using zaaReloaded2.Controller;
namespace Tests.ViewModels
{
[TestFixture]
class SettingsViewModelTest
{
SettingsViewModel _settingsVM;
[SetUp]
public void SetUp()
{
_settingsVM = new SettingsViewModel();
}
[Test]
public void AddElement()
{
}
[Test]
public void AddChildElement()
{
}
[Test]
public void CannotAddChildElementToFormatElement()
{
}
[Test]
public void DeleteElement()
{
}
[Test]
public void CopyElement()
{
}
}
}

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Bovender" version="0.2.0.0" targetFramework="net40" />
<package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net40" />
<package id="NUnit" version="2.6.4" targetFramework="net40" />
</packages>