Skip to content

Commit

Permalink
#229 setup MSUnit and delete NUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
AnhAnNek committed May 14, 2023
1 parent fd0632e commit 6057254
Show file tree
Hide file tree
Showing 321 changed files with 257,169 additions and 107,029 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ obj/
.idea/

*.htm
<<<<<<< HEAD

=======
>>>>>>> parent of 4600d69... Revert "Merge branch 'develop' into salary-v2"
TestResult/
10 changes: 5 additions & 5 deletions CompanyManagement.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 17.4.33403.182
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyManagement", "CompanyManagement\CompanyManagement.csproj", "{75A735E4-BF04-433F-8313-551F7B9EB194}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyManagementTest", "CompanyManagementTest\CompanyManagementTest.csproj", "{07570CB6-F510-4B9A-A6C2-4200270FC3BB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompanyManagementMSTest", "CompanyManagementMSTest\CompanyManagementMSTest.csproj", "{EBDE032A-B835-4E0B-869D-990CBF531287}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -17,10 +17,10 @@ Global
{75A735E4-BF04-433F-8313-551F7B9EB194}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75A735E4-BF04-433F-8313-551F7B9EB194}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75A735E4-BF04-433F-8313-551F7B9EB194}.Release|Any CPU.Build.0 = Release|Any CPU
{07570CB6-F510-4B9A-A6C2-4200270FC3BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07570CB6-F510-4B9A-A6C2-4200270FC3BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07570CB6-F510-4B9A-A6C2-4200270FC3BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07570CB6-F510-4B9A-A6C2-4200270FC3BB}.Release|Any CPU.Build.0 = Release|Any CPU
{EBDE032A-B835-4E0B-869D-990CBF531287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBDE032A-B835-4E0B-869D-990CBF531287}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBDE032A-B835-4E0B-869D-990CBF531287}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBDE032A-B835-4E0B-869D-990CBF531287}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
20 changes: 7 additions & 13 deletions CompanyManagement.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=779bb17d_002Dba20_002D46ea_002Da235_002D5496df38943e/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from &amp;lt;CompanyManagementTest&amp;gt;" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;NUnit3x::07570CB6-F510-4B9A-A6C2-4200270FC3BB::.NETFramework,Version=v4.8::CompanyManagementTest.Database.ProjectsDaoTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::07570CB6-F510-4B9A-A6C2-4200270FC3BB::.NETFramework,Version=v4.8::CompanyManagementTest.Database.LeaveRequestsDaoTest.Leave_Requests_Dao_Search_By_ID_Success&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::07570CB6-F510-4B9A-A6C2-4200270FC3BB::.NETFramework,Version=v4.8::CompanyManagementTest.Database.LeaveRequestsDaoTest.Leave_Requests_Dao_Add_Update_Delete&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::07570CB6-F510-4B9A-A6C2-4200270FC3BB::.NETFramework,Version=v4.8::CompanyManagementTest.Database.MileTasksDaoTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;NUnit3x::07570CB6-F510-4B9A-A6C2-4200270FC3BB::.NETFramework,Version=v4.8::CompanyManagementTest.Database.MilestonesDaoTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=c2623131_002Dee02_002D4abd_002D9890_002Da8ca20b06bcc/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="UtilsTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Or&gt;&#xD;
&lt;Project Location="F:\CodeExample\WPF\CompanyManagement\CompanyManagementMSTest" Presentation="&amp;lt;CompanyManagementMSTest&amp;gt;" /&gt;&#xD;
&lt;Project Location="F:\CodeExample\WPF\CompanyManagement\CompanyManagementTest" Presentation="&amp;lt;CompanyManagementTest&amp;gt;" /&gt;&#xD;
&lt;/Or&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=c2623131_002Dee02_002D4abd_002D9890_002Da8ca20b06bcc/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="UtilsTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Project Location="D:\CompanyManagement\CompanyManagementTest" Presentation="&amp;lt;CompanyManagementTest&amp;gt;" /&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=c38ff6a5_002D699c_002D4972_002D9bd7_002Da4352868262b/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Task_Statuses_Dao_Get_All" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Project Location="D:\CompanyManagement\CompanyManagementTest" Presentation="&amp;lt;CompanyManagementTest&amp;gt;" /&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=c38ff6a5_002D699c_002D4972_002D9bd7_002Da4352868262b/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Task_Statuses_Dao_Get_All" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Project Location="F:\CodeExample\WPF\CompanyManagement\CompanyManagementTest" Presentation="&amp;lt;CompanyManagementTest&amp;gt;" /&gt;&#xD;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>
89 changes: 89 additions & 0 deletions CompanyManagementMSTest/CompanyManagementMSTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EBDE032A-B835-4E0B-869D-990CBF531287}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CompanyManagementMSTest</RootNamespace>
<AssemblyName>CompanyManagementMSTest</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.7\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="Database\AccountsDaoTest.cs" />
<Compile Include="Database\DepartmentsDaoTest.cs" />
<Compile Include="Database\EmployeesDaoTest.cs" />
<Compile Include="Database\LeaveRequestsDaoTest.cs" />
<Compile Include="Database\MilestonesDaoTest.cs" />
<Compile Include="Database\MileTasksDaoTest.cs" />
<Compile Include="Database\ProjectAssignmentsDaoTest.cs" />
<Compile Include="Database\ProjectBonusesDaoTest.cs" />
<Compile Include="Database\ProjectsDaoTest.cs" />
<Compile Include="Database\RolesDaoTest.cs" />
<Compile Include="Database\SalaryRecordsDaoTest.cs" />
<Compile Include="Database\TaskCheckOutsDaoTest.cs" />
<Compile Include="Database\TasksDaoTest.cs" />
<Compile Include="Database\TimeSheetsCIODaoTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UtilitiesTest\UtilsTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CompanyManagement\CompanyManagement.csproj">
<Project>{75a735e4-bf04-433f-8313-551f7b9eb194}</Project>
<Name>CompanyManagement</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.7\build\net45\MSTest.TestAdapter.targets')" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using CompanyManagement.Database;
using CompanyManagement.Database.Base;
using CompanyManagement.Models;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CompanyManagementTest.Database
namespace CompanyManagementMSTest.Database
{
[TestFixture]
[TestClass]
public class AccountsDaoTest
{
private AccountsDao myDao;

[SetUp]
[TestInitialize]
public void SetUp()
{
myDao = new AccountsDao();
}

[Test]
[TestMethod]
public void Add_Update_Delete_Success()
{
var acc = new Account("TestTest", "1234567", "EM057");
Expand Down Expand Up @@ -44,7 +44,7 @@ public void Add_Update_Delete_Success()
Assert.IsNull(deleted);
}

[Test]
[TestMethod]
public void SearchByUsername_Found()
{
var acc = myDao.SearchByUsername("EM0010101");
Expand All @@ -58,6 +58,7 @@ public Account Search(Account account)
string sqlStr = $"SELECT * FROM Accounts WHERE Username = '{account.Username}' ";
return (Account)dbConnection.GetSingleObject(sqlStr, reader => new Account(reader));
}

private void AssertObject(Account expected, Account actual)
{
Assert.IsNotNull(actual);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using CompanyManagement.Database;
using CompanyManagement.Models;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CompanyManagementTest.Database
namespace CompanyManagementMSTest.Database
{
[TestFixture]
[TestClass]
public class DepartmentsDaoTest
{
private DepartmentsDao myDao;

[SetUp]
[TestInitialize]
public void SetUp()
{
myDao = new DepartmentsDao();
}

[Test]
[TestMethod]
public void SearchByID_Found()
{
var expected = new Department("DPM001", "Software Development Department", "EM006");
Expand All @@ -24,7 +24,7 @@ public void SearchByID_Found()
AssertObject(expected, actualSearch);
}

[Test]
[TestMethod]
public void Add_Update_Delete_Success()
{
var dept = new Department("DPM1231", "Core Department Test", "EM123");
Expand Down Expand Up @@ -53,7 +53,7 @@ public void Add_Update_Delete_Success()
Assert.IsNull(afterDelete);
}

[Test]
[TestMethod]
public void GetAll_Success()
{
var list = myDao.GetAll();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using System;
using CompanyManagement;
using CompanyManagement.Database;
using NUnit.Framework;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CompanyManagementTest.Database
namespace CompanyManagementMSTest.Database
{
[TestFixture]
[TestClass]
public class EmployeesDaoTest
{
private EmployeesDao myDao;

[SetUp]
[TestInitialize]
public void SetUp()
{
myDao = new EmployeesDao();
}

[Test]
[TestMethod]
public void SearchByID_Found()
{
var expected = new Employee("EM001", "Nguyễn Văn An", "Nam",
Expand All @@ -28,7 +28,7 @@ public void SearchByID_Found()
AssertObject(expected, actualSearch);
}

[Test]
[TestMethod]
public void Add_Update_Delete_Success()
{
var empl = new Employee("EM12312", "Nguyễn Văn Anh Hoàng", "Nam",
Expand Down Expand Up @@ -62,21 +62,21 @@ public void Add_Update_Delete_Success()
Assert.IsNull(afterDelete);
}

[Test]
[TestMethod]
public void GetAll_Found()
{
var list = myDao.GetAll();
Assert.AreEqual(55, list.Count);
}

[Test]
[TestMethod]
public void GetAllWithoutManagers_Found()
{
var list = myDao.GetAllWithoutManagers();
Assert.AreEqual(50, list.Count);
}

[Test]
[TestMethod]
public void SearchByIdentifyCard_Found()
{
var expected = new Employee("EM001", "Nguyễn Văn An", "Nam",
Expand All @@ -89,7 +89,7 @@ public void SearchByIdentifyCard_Found()
AssertObject(expected, actual);
}

[Test]
[TestMethod]
public void SearchByPhoneNumber_Found()
{
var expected = new Employee("EM001", "Nguyễn Văn An", "Nam",
Expand All @@ -102,14 +102,14 @@ public void SearchByPhoneNumber_Found()
AssertObject(expected, actual);
}

[Test]
[TestMethod]
public void GetRequestApprovers_Found()
{
var list = myDao.GetRequestApprovers();
Assert.AreEqual(1,list.Count);
}

[Test]
[TestMethod]
public void SearchByDepartmentID_Found()
{
var expected = new Employee("EM001", "Nguyễn Văn An", "Nam",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
using CompanyManagement.Database;
using CompanyManagement.Enums;
using CompanyManagement.Models;
using NUnit.Framework;
using NUnit.Framework.Internal;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CompanyManagementTest.Database
namespace CompanyManagementMSTest.Database
{
[TestFixture]
[TestClass]
public class LeaveRequestsDaoTest
{
private LeaveRequestsDao myDao;
private LeaveRequest leaveRequest;

[SetUp]
[TestInitialize]
public void SetUp()
{
myDao = new LeaveRequestsDao();
Expand All @@ -31,7 +30,7 @@ public void SetUp()
};
}

[Test]
[TestMethod]
public void Search_By_ID_Success()
{
var expected = new LeaveRequest();
Expand All @@ -49,21 +48,21 @@ public void Search_By_ID_Success()
AssertObject(expected, actualSearch);
}

[Test]
[TestMethod]
public void GetMyRequests_Found()
{
var list = myDao.GetMyRequests("EM007");
Assert.AreEqual(1, list.Count);
}

[Test]
[TestMethod]
public void SearchByApproverID_Found()
{
var list = myDao.SearchByApproverID("EM006");
Assert.AreEqual(2, list.Count);
}

[Test]
[TestMethod]
public void Add_Update_Delete()
{
// add
Expand Down
Loading

0 comments on commit 6057254

Please sign in to comment.