diff options
18 files changed, 429 insertions, 5 deletions
diff --git a/ApartmentManager/ApartmentManager.sln b/ApartmentManager/ApartmentManager.sln index 86bb4ee..24bd7f5 100644 --- a/ApartmentManager/ApartmentManager.sln +++ b/ApartmentManager/ApartmentManager.sln @@ -10,6 +10,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApartmentManager", "Apartme EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HousingWebApi", "HousingWebApi\HousingWebApi.csproj", "{D777744A-9676-4193-BD59-6F30C724C87A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApartmentManagerUnitTestProject", "ApartmentManagerUnitTestProject\ApartmentManagerUnitTestProject.csproj", "{A518A278-3296-4260-A15C-B3C165C28943}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -59,6 +61,26 @@ Global {D777744A-9676-4193-BD59-6F30C724C87A}.Release|x64.Build.0 = Release|Any CPU {D777744A-9676-4193-BD59-6F30C724C87A}.Release|x86.ActiveCfg = Release|Any CPU {D777744A-9676-4193-BD59-6F30C724C87A}.Release|x86.Build.0 = Release|Any CPU + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|Any CPU.ActiveCfg = Debug|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|ARM.ActiveCfg = Debug|ARM + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|ARM.Build.0 = Debug|ARM + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|ARM.Deploy.0 = Debug|ARM + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|x64.ActiveCfg = Debug|x64 + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|x64.Build.0 = Debug|x64 + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|x64.Deploy.0 = Debug|x64 + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|x86.ActiveCfg = Debug|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|x86.Build.0 = Debug|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Debug|x86.Deploy.0 = Debug|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|Any CPU.ActiveCfg = Release|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|ARM.ActiveCfg = Release|ARM + {A518A278-3296-4260-A15C-B3C165C28943}.Release|ARM.Build.0 = Release|ARM + {A518A278-3296-4260-A15C-B3C165C28943}.Release|ARM.Deploy.0 = Release|ARM + {A518A278-3296-4260-A15C-B3C165C28943}.Release|x64.ActiveCfg = Release|x64 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|x64.Build.0 = Release|x64 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|x64.Deploy.0 = Release|x64 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|x86.ActiveCfg = Release|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|x86.Build.0 = Release|x86 + {A518A278-3296-4260-A15C-B3C165C28943}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index e8a52ff..b3f941c 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -11,8 +11,8 @@ <AssemblyName>ApartmentManager</AssemblyName> <DefaultLanguage>en-US</DefaultLanguage> <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> - <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.14393.0</TargetPlatformVersion> - <TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion> + <TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.15063.0</TargetPlatformVersion> + <TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion> <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs index 34cbb7c..4cfa4fd 100644 --- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs +++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs @@ -77,9 +77,9 @@ namespace ApartmentManager.Handler { resident.Picture = "http://i.imgur.com/8KNkU26.png"; } - if (!string.IsNullOrEmpty(resident.FirstName) && !string.IsNullOrEmpty(resident.FirstName)) + if (!string.IsNullOrEmpty(resident.FirstName) && !string.IsNullOrEmpty(resident.LastName)) { - ApiClient.PostData("api/residents/", resident); + var response = ApiClient.PostData("api/residents/", resident); } GetApartmentResidents(); } diff --git a/ApartmentManager/ApartmentManager/Singletons/UserSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/UserSingleton.cs index 1f291c9..37435f5 100644 --- a/ApartmentManager/ApartmentManager/Singletons/UserSingleton.cs +++ b/ApartmentManager/ApartmentManager/Singletons/UserSingleton.cs @@ -9,6 +9,9 @@ namespace ApartmentManager.Singletons public User CurrentUser { get; set; } - private UserSingleton() { } + private UserSingleton() + { + CurrentUser = new User(); + } } } diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/ApartmentManagerUnitTestProject.csproj b/ApartmentManager/ApartmentManagerUnitTestProject/ApartmentManagerUnitTestProject.csproj new file mode 100644 index 0000000..315d0b1 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/ApartmentManagerUnitTestProject.csproj @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProjectGuid>{A518A278-3296-4260-A15C-B3C165C28943}</ProjectGuid> + <OutputType>AppContainerExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ApartmentManagerUnitTestProject</RootNamespace> + <AssemblyName>ApartmentManagerUnitTestProject</AssemblyName> + <DefaultLanguage>en-US</DefaultLanguage> + <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> + <TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion> + <TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion> + <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <PackageCertificateKeyFile>ApartmentManagerUnitTestProject_TemporaryKey.pfx</PackageCertificateKeyFile> + <UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x86\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> + <OutputPath>bin\x86\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x86</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\ARM\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'"> + <OutputPath>bin\ARM\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>ARM</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\x64\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <NoWarn>;2008</NoWarn> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <OutputPath>bin\x64\Release\</OutputPath> + <DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants> + <Optimize>true</Optimize> + <NoWarn>;2008</NoWarn> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <UseVSHostingProcess>false</UseVSHostingProcess> + <ErrorReport>prompt</ErrorReport> + <Prefer32Bit>true</Prefer32Bit> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <ItemGroup> + <SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="UnitTestApp.xaml.cs"> + <DependentUpon>UnitTestApp.xaml</DependentUpon> + </Compile> + <Compile Include="UnitTest.cs" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="UnitTestApp.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + <None Include="ApartmentManagerUnitTestProject_TemporaryKey.pfx" /> + </ItemGroup> + <ItemGroup> + <Content Include="Properties\UnitTestApp.rd.xml" /> + <Content Include="Assets\LockScreenLogo.scale-200.png" /> + <Content Include="Assets\SplashScreen.scale-200.png" /> + <Content Include="Assets\Square150x150Logo.scale-200.png" /> + <Content Include="Assets\Square44x44Logo.scale-200.png" /> + <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> + <Content Include="Assets\StoreLogo.png" /> + <Content Include="Assets\Wide310x150Logo.scale-200.png" /> + </ItemGroup> + <ItemGroup> + <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform"> + <Version>5.3.3</Version> + </PackageReference> + <PackageReference Include="MSTest.TestAdapter"> + <Version>1.1.17</Version> + </PackageReference> + <PackageReference Include="MSTest.TestFramework"> + <Version>1.1.17</Version> + </PackageReference> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\ApartmentManager\ApartmentManager.csproj"> + <Project>{95401ed6-d03c-417d-8897-81b5454d2426}</Project> + <Name>ApartmentManager</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' "> + <VisualStudioVersion>14.0</VisualStudioVersion> + </PropertyGroup> + <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.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. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/LockScreenLogo.scale-200.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/LockScreenLogo.scale-200.png Binary files differnew file mode 100644 index 0000000..735f57a --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/LockScreenLogo.scale-200.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/SplashScreen.scale-200.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/SplashScreen.scale-200.png Binary files differnew file mode 100644 index 0000000..023e7f1 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/SplashScreen.scale-200.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square150x150Logo.scale-200.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square150x150Logo.scale-200.png Binary files differnew file mode 100644 index 0000000..af49fec --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square150x150Logo.scale-200.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square44x44Logo.scale-200.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square44x44Logo.scale-200.png Binary files differnew file mode 100644 index 0000000..ce342a2 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square44x44Logo.scale-200.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square44x44Logo.targetsize-24_altform-unplated.png Binary files differnew file mode 100644 index 0000000..f6c02ce --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/StoreLogo.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/StoreLogo.png Binary files differnew file mode 100644 index 0000000..7385b56 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/StoreLogo.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Wide310x150Logo.scale-200.png b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Wide310x150Logo.scale-200.png Binary files differnew file mode 100644 index 0000000..288995b --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Assets/Wide310x150Logo.scale-200.png diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Package.appxmanifest b/ApartmentManager/ApartmentManagerUnitTestProject/Package.appxmanifest new file mode 100644 index 0000000..f54fbcf --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Package.appxmanifest @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + IgnorableNamespaces="uap mp"> + + <Identity Name="02fc20e5-e2d0-4555-aecd-52d6d99396ec" + Publisher="CN=Danix" + Version="1.0.0.0" /> + + <mp:PhoneIdentity PhoneProductId="02fc20e5-e2d0-4555-aecd-52d6d99396ec" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + + <Properties> + <DisplayName>ApartmentManagerUnitTestProject</DisplayName> + <PublisherDisplayName>Danix</PublisherDisplayName> + <Logo>Assets\StoreLogo.png</Logo> + </Properties> + + <Dependencies> + <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" /> + </Dependencies> + + <Resources> + <Resource Language="x-generate" /> + </Resources> + <Applications> + <Application Id="vstest.executionengine.universal.App" + Executable="$targetnametoken$.exe" + EntryPoint="ApartmentManagerUnitTestProject.App"> + <uap:VisualElements + DisplayName="ApartmentManagerUnitTestProject" + Square150x150Logo="Assets\Square150x150Logo.png" + Square44x44Logo="Assets\Square44x44Logo.png" + Description="ApartmentManagerUnitTestProject" + BackgroundColor="transparent"> + <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/> + <uap:SplashScreen Image="Assets\SplashScreen.png" /> + </uap:VisualElements> + </Application> + </Applications> + <Capabilities> + <Capability Name="internetClientServer" /> + </Capabilities> +</Package>
\ No newline at end of file diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Properties/AssemblyInfo.cs b/ApartmentManager/ApartmentManagerUnitTestProject/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..742e0d1 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("ApartmentManagerUnitTestProject")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ApartmentManagerUnitTestProject")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: AssemblyMetadata("TargetPlatform","UAP")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/Properties/UnitTestApp.rd.xml b/ApartmentManager/ApartmentManagerUnitTestProject/Properties/UnitTestApp.rd.xml new file mode 100644 index 0000000..efee59d --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/Properties/UnitTestApp.rd.xml @@ -0,0 +1,29 @@ +<!-- + This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most + developers. However, you can modify these parameters to modify the behavior of the .NET Native + optimizer. + + Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919 + + To fully enable reflection for App1.MyClass and all of its public/private members + <Type Name="App1.MyClass" Dynamic="Required All"/> + + To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32 + <TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" /> + + Using the Namespace directive to apply reflection policy to all the types in a particular namespace + <Namespace Name="DataClasses.ViewModels" Seralize="All" /> +--> + +<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata"> + <Application> + <!-- + An Assembly element with Name="*Application*" applies to all assemblies in + the application package. The asterisks are not wildcards. + --> + <Assembly Name="*Application*" Dynamic="Required All" /> + <!-- Add your application specific runtime directives here. --> + + + </Application> +</Directives>
\ No newline at end of file diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/UnitTest.cs b/ApartmentManager/ApartmentManagerUnitTestProject/UnitTest.cs new file mode 100644 index 0000000..52bcb27 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/UnitTest.cs @@ -0,0 +1,40 @@ + +using System; +using ApartmentManager.ViewModel; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace ApartmentManagerUnitTestProject +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + ApartmentViewModel model = new ApartmentViewModel(); + model.UserSingleton.CurrentUser.ApartmentId = 1; + model.NewResident.FirstName = "asd"; + model.NewResident.LastName = "lopas"; + model.ApartmentHandler.GetApartmentResidents(); + var currentDefects = model.CatalogSingleton.Residents.Count; + //test// + model.ApartmentHandler.CreateResident(); + Assert.AreNotEqual(currentDefects, model.CatalogSingleton.Residents); + + } + [TestMethod] + public void TestMethod2() + { + ApartmentViewModel model = new ApartmentViewModel(); + model.UserSingleton.CurrentUser.ApartmentId = 1; + model.NewResident.FirstName = "asd"; + model.NewResident.LastName = "lopas"; + model.ApartmentHandler.GetApartmentResidents(); + var currentDefects = model.CatalogSingleton.Residents.Count; + //test// + //model.ApartmentHandler.CreateResident(); + Assert.AreNotEqual(currentDefects, model.CatalogSingleton.Residents); + + } + } +} diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/UnitTestApp.xaml b/ApartmentManager/ApartmentManagerUnitTestProject/UnitTestApp.xaml new file mode 100644 index 0000000..1081191 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/UnitTestApp.xaml @@ -0,0 +1,8 @@ +<Application + x:Class="ApartmentManagerUnitTestProject.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:ApartmentManagerUnitTestProject" + RequestedTheme="Light"> + +</Application> diff --git a/ApartmentManager/ApartmentManagerUnitTestProject/UnitTestApp.xaml.cs b/ApartmentManager/ApartmentManagerUnitTestProject/UnitTestApp.xaml.cs new file mode 100644 index 0000000..19b8201 --- /dev/null +++ b/ApartmentManager/ApartmentManagerUnitTestProject/UnitTestApp.xaml.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +namespace ApartmentManagerUnitTestProject +{ + /// <summary> + /// Provides application-specific behavior to supplement the default Application class. + /// </summary> + sealed partial class App : Application + { + /// <summary> + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// </summary> + public App() + { + this.InitializeComponent(); + this.Suspending += OnSuspending; + } + + /// <summary> + /// Invoked when the application is launched normally by the end user. Other entry points + /// will be used such as when the application is launched to open a specific file. + /// </summary> + /// <param name="e">Details about the launch request and process.</param> + protected override void OnLaunched(LaunchActivatedEventArgs e) + { + +#if DEBUG + if (System.Diagnostics.Debugger.IsAttached) + { + this.DebugSettings.EnableFrameRateCounter = true; + } +#endif + + Frame rootFrame = Window.Current.Content as Frame; + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == null) + { + // Create a Frame to act as the navigation context and navigate to the first page + rootFrame = new Frame(); + + rootFrame.NavigationFailed += OnNavigationFailed; + + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) + { + //TODO: Load state from previously suspended application + } + + // Place the frame in the current Window + Window.Current.Content = rootFrame; + } + + Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI(); + + // Ensure the current window is active + Window.Current.Activate(); + + Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments); + } + + /// <summary> + /// Invoked when Navigation to a certain page fails + /// </summary> + /// <param name="sender">The Frame which failed navigation</param> + /// <param name="e">Details about the navigation failure</param> + void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + { + throw new Exception("Failed to load Page " + e.SourcePageType.FullName); + } + + /// <summary> + /// Invoked when application execution is being suspended. Application state is saved + /// without knowing whether the application will be terminated or resumed with the contents + /// of memory still intact. + /// </summary> + /// <param name="sender">The source of the suspend request.</param> + /// <param name="e">Details about the suspend request.</param> + private void OnSuspending(object sender, SuspendingEventArgs e) + { + var deferral = e.SuspendingOperation.GetDeferral(); + //TODO: Save application state and stop any background activity + deferral.Complete(); + } + } +} |