Initial commit
This commit is contained in:
commit
5ac440891e
BIN
Application/.vs/Application/v16/.suo
Normal file
BIN
Application/.vs/Application/v16/.suo
Normal file
Binary file not shown.
BIN
Application/.vs/Application/v16/TestStore/0/003.testlog
Normal file
BIN
Application/.vs/Application/v16/TestStore/0/003.testlog
Normal file
Binary file not shown.
BIN
Application/.vs/Application/v16/TestStore/0/testlog.manifest
Normal file
BIN
Application/.vs/Application/v16/TestStore/0/testlog.manifest
Normal file
Binary file not shown.
31
Application/Application.sln
Normal file
31
Application/Application.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30011.22
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{D284EEC7-6387-4E75-8AB4-9578C750AF74}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject", "UnitTestProject\UnitTestProject.csproj", "{55561B18-4BC5-4308-B08D-4B8B7032C48F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D284EEC7-6387-4E75-8AB4-9578C750AF74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D284EEC7-6387-4E75-8AB4-9578C750AF74}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D284EEC7-6387-4E75-8AB4-9578C750AF74}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D284EEC7-6387-4E75-8AB4-9578C750AF74}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{55561B18-4BC5-4308-B08D-4B8B7032C48F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{55561B18-4BC5-4308-B08D-4B8B7032C48F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{55561B18-4BC5-4308-B08D-4B8B7032C48F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{55561B18-4BC5-4308-B08D-4B8B7032C48F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1AE5B67A-952F-4603-A76A-8108F8DAF7CE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
6
Application/Application/App.config
Normal file
6
Application/Application/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
55
Application/Application/Application.csproj
Normal file
55
Application/Application/Application.csproj
Normal file
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" 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)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D284EEC7-6387-4E75-8AB4-9578C750AF74}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Application</RootNamespace>
|
||||
<AssemblyName>Application</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<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' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FileSystem.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
59
Application/Application/FileSystem.cs
Normal file
59
Application/Application/FileSystem.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Application
|
||||
{
|
||||
public class FileSystem
|
||||
{
|
||||
public static bool CreateFile(String filename)
|
||||
{
|
||||
FileStream fs = null;
|
||||
try
|
||||
{
|
||||
//incorrect file name
|
||||
if(filename.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
|
||||
throw new Exception("Incorrect filename!");
|
||||
else
|
||||
{
|
||||
fs = File.Create(filename);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(!(fs==null))
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
if (fs != null)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void SaveUsersToFile(String filename, List<User> users)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (StreamWriter writer = new StreamWriter(Path.Combine(Directory.GetCurrentDirectory(), filename)))
|
||||
{
|
||||
foreach (var user in users)
|
||||
{
|
||||
writer.WriteLine(user.FirstName);
|
||||
writer.WriteLine(user.LastName);
|
||||
writer.WriteLine(user.City);
|
||||
writer.WriteLine(user.Pesel);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
96
Application/Application/Program.cs
Normal file
96
Application/Application/Program.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Application
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static String filename = "users.txt";
|
||||
//private static String filename = "\"\"";
|
||||
static void Main(string[] args)
|
||||
{
|
||||
App();
|
||||
}
|
||||
|
||||
static void App()
|
||||
{
|
||||
List<User> list_of_users = new List<User>();
|
||||
|
||||
if (!FileSystem.CreateFile(filename))
|
||||
{
|
||||
Console.WriteLine("Cannot create file!");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
bool main_loop = true;
|
||||
String command = "";
|
||||
|
||||
while (main_loop)
|
||||
{
|
||||
Console.WriteLine("1 Create new user");
|
||||
Console.WriteLine("2 Exit");
|
||||
Console.Write("Command: ");
|
||||
command = Console.ReadLine();
|
||||
|
||||
// add user
|
||||
if (command.Trim() == "1")
|
||||
{
|
||||
User user = new User();
|
||||
bool user_flag = true;
|
||||
|
||||
while (user_flag)
|
||||
{
|
||||
Console.Write("Enter first name: ");
|
||||
user.FirstName = Console.ReadLine().Trim();
|
||||
|
||||
Console.Write("Enter last name: ");
|
||||
user.LastName = Console.ReadLine().Trim();
|
||||
|
||||
Console.Write("Enter city: ");
|
||||
user.City = Console.ReadLine().Trim();
|
||||
|
||||
Console.Write("Enter Pesel: ");
|
||||
user.Pesel = Console.ReadLine().Trim();
|
||||
|
||||
if (user.CheckingPesel()==0)
|
||||
{
|
||||
if (!User.UserExists(ref list_of_users, user))
|
||||
list_of_users.Add(user);
|
||||
FileSystem.SaveUsersToFile(filename, list_of_users);
|
||||
user_flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Incorect Pesel");
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Press Enter to continue");
|
||||
Console.ReadLine();
|
||||
|
||||
}
|
||||
// exit program
|
||||
else if (command.Trim() == "2")
|
||||
{
|
||||
main_loop = false;
|
||||
}
|
||||
// unknown command
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Unknown command");
|
||||
|
||||
Console.WriteLine("Press Enter to continue");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
Console.Clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
Application/Application/Properties/AssemblyInfo.cs
Normal file
36
Application/Application/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Application")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Application")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d284eec7-6387-4e75-8ab4-9578c750af74")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
198
Application/Application/User.cs
Normal file
198
Application/Application/User.cs
Normal file
@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Application
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public String FirstName { get; set; }
|
||||
public String LastName { get; set; }
|
||||
public String City { get; set; }
|
||||
public String Pesel { get; set; }
|
||||
|
||||
|
||||
//checking pesel without gender (sex)
|
||||
public int CheckingPesel()
|
||||
{
|
||||
/*
|
||||
Returns:
|
||||
0 - valid pesel
|
||||
1 - invalid control digit
|
||||
2 - invalid date of birth
|
||||
3 - invalid characters of pesel
|
||||
4 - invalid length of pesel
|
||||
*/
|
||||
int flag = 4;
|
||||
|
||||
Regex regex = new Regex("^[0-9]*$");
|
||||
|
||||
/// 1. Checking length of pesel
|
||||
if (Pesel.Length == 11)
|
||||
{
|
||||
flag--;
|
||||
/// 2. Checking characters
|
||||
if (regex.IsMatch(Pesel))
|
||||
{
|
||||
flag--;
|
||||
/// 3. Checking date of birth
|
||||
if (CheckingDateOfBirth(Pesel))
|
||||
{
|
||||
flag--;
|
||||
/// 4. Checking control digit
|
||||
if (CheckingControlDigit(Pesel))
|
||||
{
|
||||
flag--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
private static bool CheckingDateOfBirth(String Pesel)
|
||||
{
|
||||
bool flag = true;
|
||||
String year = Pesel.Substring(0, 2);
|
||||
String month = Pesel.Substring(2, 2);
|
||||
String day = Pesel.Substring(4, 2);
|
||||
|
||||
//checking month
|
||||
int m1 = Convert.ToInt32(month.Substring(0, 1));
|
||||
int m2 = Convert.ToInt32(month.Substring(1, 1));
|
||||
|
||||
if (m1 % 2 != 0)
|
||||
{
|
||||
if (m2 > 2)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
int m = (m1 % 2) * 10 + m2;
|
||||
|
||||
int d1 = Convert.ToInt32(day.Substring(0, 1));
|
||||
int d2 = Convert.ToInt32(day.Substring(1, 1));
|
||||
int d = d1 * 10 + d2;
|
||||
|
||||
int y1 = Convert.ToInt32(year.Substring(0, 1));
|
||||
int y2 = Convert.ToInt32(year.Substring(1, 1));
|
||||
int y = y1 * 10 + y2;
|
||||
|
||||
if (m1 <= 1)
|
||||
y = 1900 + y;
|
||||
else if (m1 <= 3)
|
||||
y = 2000 + y;
|
||||
else if (m1 <= 5)
|
||||
y = 2100 + y;
|
||||
else if (m1 <= 7)
|
||||
y = 2200 + y;
|
||||
else
|
||||
y = 1800 + y;
|
||||
//Console.WriteLine("Date:" +d+" "+m +" "+y);
|
||||
|
||||
int[] daysMonth = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
//checking month
|
||||
if (m > 12 || m < 1)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
/// checking days in month
|
||||
///
|
||||
//for Februrary
|
||||
else if (m == 2)
|
||||
{
|
||||
if (!(y % 4 == 0 && y % 100 != 0 || y % 400 == 0))
|
||||
flag = false;
|
||||
}
|
||||
//for others months
|
||||
else if (d > daysMonth[m - 1])
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
private static bool CheckingControlDigit(String Pesel)
|
||||
{
|
||||
bool flag = false;
|
||||
int result = 0;
|
||||
int[] coff = { 9, 7, 3, 1, 9, 7, 3, 1, 9, 7 };//coefficient
|
||||
int[] digit_of_pesel = new int[11];
|
||||
int index = 0;
|
||||
|
||||
foreach (var s in Pesel)
|
||||
{
|
||||
digit_of_pesel[index++] = Convert.ToInt32(s) - Convert.ToInt32('0');
|
||||
}
|
||||
for (int i = 0; i < coff.Length; i++)
|
||||
{
|
||||
result += (coff[i] * digit_of_pesel[i]);
|
||||
//Console.WriteLine(s);
|
||||
}
|
||||
|
||||
result %= 10;
|
||||
|
||||
if (result == digit_of_pesel[10])
|
||||
flag = true;
|
||||
|
||||
return flag;
|
||||
|
||||
}
|
||||
|
||||
public static bool UserExists(ref List<User> list_of_users, User user)
|
||||
{
|
||||
bool flag = false;
|
||||
|
||||
int index = 0;
|
||||
foreach (var u in list_of_users)
|
||||
{
|
||||
if (u.Pesel == user.Pesel
|
||||
&& (u.FirstName != user.FirstName
|
||||
|| u.LastName != user.LastName))
|
||||
{
|
||||
|
||||
flag = true;
|
||||
list_of_users[index].FirstName = user.FirstName;
|
||||
list_of_users[index].LastName = user.LastName;
|
||||
list_of_users[index].City = user.City;
|
||||
break;
|
||||
}
|
||||
else if (u.Pesel == user.Pesel
|
||||
&& u.FirstName == user.FirstName
|
||||
&& u.LastName == user.LastName)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return flag;
|
||||
|
||||
}
|
||||
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
|
||||
if (!(obj is User)) throw new Exception("Incorrect parameter! It should be object of User class!");
|
||||
|
||||
User user = obj as User;
|
||||
|
||||
bool condition = this.FirstName==user.FirstName &&
|
||||
this.LastName== user.LastName && this.Pesel==user.Pesel;
|
||||
|
||||
if (condition)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
Application/Application/bin/Debug/Application.exe
Normal file
BIN
Application/Application/bin/Debug/Application.exe
Normal file
Binary file not shown.
6
Application/Application/bin/Debug/Application.exe.config
Normal file
6
Application/Application/bin/Debug/Application.exe.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
BIN
Application/Application/bin/Debug/Application.pdb
Normal file
BIN
Application/Application/bin/Debug/Application.pdb
Normal file
Binary file not shown.
0
Application/Application/bin/Debug/file.txt
Normal file
0
Application/Application/bin/Debug/file.txt
Normal file
0
Application/Application/bin/Debug/users.txt
Normal file
0
Application/Application/bin/Debug/users.txt
Normal file
@ -0,0 +1 @@
|
||||
7908dbf799151c4f6e54e47a83a716f739ee9a62
|
@ -0,0 +1,7 @@
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\bin\Debug\Application.exe.config
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\bin\Debug\Application.exe
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\bin\Debug\Application.pdb
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\obj\Debug\Application.csprojAssemblyReference.cache
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\obj\Debug\Application.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\obj\Debug\Application.exe
|
||||
C:\Users\Dominik\Desktop\project\Application\Application\obj\Debug\Application.pdb
|
Binary file not shown.
BIN
Application/Application/obj/Debug/Application.exe
Normal file
BIN
Application/Application/obj/Debug/Application.exe
Normal file
Binary file not shown.
BIN
Application/Application/obj/Debug/Application.pdb
Normal file
BIN
Application/Application/obj/Debug/Application.pdb
Normal file
Binary file not shown.
Binary file not shown.
24
Application/UnitTestProject/FileSystemTest.cs
Normal file
24
Application/UnitTestProject/FileSystemTest.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Application;
|
||||
|
||||
namespace UnitTestProject
|
||||
{
|
||||
[TestClass]
|
||||
public class FileSystemTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void CheckCreateFile()
|
||||
{
|
||||
//Arrange
|
||||
bool correctCreatedFile = FileSystem.CreateFile("file.txt");
|
||||
bool incorrectCreatedFile = FileSystem.CreateFile("\"\"");
|
||||
|
||||
//Asssert
|
||||
Assert.IsTrue(correctCreatedFile);
|
||||
|
||||
//test of incorect name of file
|
||||
Assert.IsFalse(incorrectCreatedFile);
|
||||
}
|
||||
}
|
||||
}
|
20
Application/UnitTestProject/Properties/AssemblyInfo.cs
Normal file
20
Application/UnitTestProject/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("UnitTestProject")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTestProject")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("55561b18-4bc5-4308-b08d-4b8b7032c48f")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
75
Application/UnitTestProject/UnitTestProject.csproj
Normal file
75
Application/UnitTestProject/UnitTestProject.csproj
Normal file
@ -0,0 +1,75 @@
|
||||
<?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.1.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.0\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>{55561B18-4BC5-4308-B08D-4B8B7032C48F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UnitTestProject</RootNamespace>
|
||||
<AssemblyName>UnitTestProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</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.1.0\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.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FileSystemTest.cs" />
|
||||
<Compile Include="UserTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Application\Application.csproj">
|
||||
<Project>{D284EEC7-6387-4E75-8AB4-9578C750AF74}</Project>
|
||||
<Name>Application</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.1.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
187
Application/UnitTestProject/UserTest.cs
Normal file
187
Application/UnitTestProject/UserTest.cs
Normal file
@ -0,0 +1,187 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Application;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace UnitTestProject
|
||||
{
|
||||
[TestClass]
|
||||
public class UserTest
|
||||
{
|
||||
public int setArrangePesel(string pesel)
|
||||
{
|
||||
User user = new User();
|
||||
user.Pesel = pesel;
|
||||
|
||||
return user.CheckingPesel();
|
||||
}
|
||||
|
||||
public void setArrangeListOfUsers(ref List<User> list_of_users)
|
||||
{
|
||||
list_of_users.Add(new User() { FirstName = "Adam", LastName = "Kowalski", City = "Poznań", Pesel = "98042155976" });
|
||||
list_of_users.Add(new User() { FirstName = "Jan", LastName = "Nowak", City = "Bydgoszcz", Pesel = "85070789433" });
|
||||
list_of_users.Add(new User() { FirstName = "Adam", LastName = "Kowalski", City = "Warszawa", Pesel = "55122952416" });
|
||||
}
|
||||
|
||||
public bool CheckConditionOfUserExist(ref List<User> list_of_users,User u1)
|
||||
{
|
||||
bool condition = false;
|
||||
foreach (var user in list_of_users)
|
||||
{
|
||||
if (u1.Equals(user))
|
||||
{
|
||||
condition = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return condition;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/// check Pesel
|
||||
|
||||
[TestMethod]
|
||||
public void CheckingValidPesel()
|
||||
{
|
||||
//arrange
|
||||
int actualResult = setArrangePesel("47042886355");
|
||||
int expectedResult = 0;
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, actualResult);
|
||||
}
|
||||
|
||||
///checking invalid pesel
|
||||
[TestMethod]
|
||||
public void InvalidDigitControl()
|
||||
{
|
||||
//arrange
|
||||
int actualResult = setArrangePesel("47042886356");
|
||||
int expectedResult = 1;
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, actualResult);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidDateOfPesel()
|
||||
{
|
||||
//arrange
|
||||
int actualResult = setArrangePesel("47007286356");
|
||||
int expectedResult = 2;
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, actualResult);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidCharactersOfPesel()
|
||||
{
|
||||
//arrange
|
||||
int actualResult = setArrangePesel("47042886a56");
|
||||
int expectedResult = 3;
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, actualResult);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void InvalidLengthOfPesel()
|
||||
{
|
||||
//arrange
|
||||
int actualResult = setArrangePesel("474");
|
||||
int expectedResult = 4;
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, actualResult);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//user exists
|
||||
[TestMethod]
|
||||
public void CheckNotExistingUser()
|
||||
{
|
||||
//arrange
|
||||
var list_of_users = new List<User>();
|
||||
setArrangeListOfUsers(ref list_of_users);
|
||||
User u1 =new User(){ FirstName = "Andrzej", LastName = "Frankowski", City = "Lublin", Pesel = "71052429624" };
|
||||
|
||||
bool conditionBeforeAddUser = CheckConditionOfUserExist(ref list_of_users, u1);
|
||||
bool condition = User.UserExists(ref list_of_users, u1);
|
||||
bool conditionAfterAddUser = CheckConditionOfUserExist(ref list_of_users, u1);
|
||||
|
||||
|
||||
//Assert
|
||||
Assert.IsFalse(condition);
|
||||
Assert.IsFalse(conditionBeforeAddUser);
|
||||
Assert.IsFalse(conditionAfterAddUser);
|
||||
}
|
||||
|
||||
//user with this same pesel but diffrent name and surname
|
||||
[TestMethod]
|
||||
public void CheckExistingUser1()
|
||||
{
|
||||
//arrange
|
||||
var list_of_users = new List<User>();
|
||||
setArrangeListOfUsers(ref list_of_users);
|
||||
User u1 = new User() { FirstName = "Andrzej", LastName = "Frankowski", City = "Lublin", Pesel = "55122952416" };
|
||||
|
||||
bool conditionBeforeAddUser = CheckConditionOfUserExist(ref list_of_users, u1);
|
||||
bool condition = User.UserExists(ref list_of_users, u1);
|
||||
bool conditionAfterAddUser = CheckConditionOfUserExist(ref list_of_users, u1);
|
||||
|
||||
//Assert
|
||||
Assert.IsTrue(condition);
|
||||
Assert.IsFalse(conditionBeforeAddUser);
|
||||
Assert.IsTrue(conditionAfterAddUser);
|
||||
}
|
||||
|
||||
//user with this same pesel and other data
|
||||
[TestMethod]
|
||||
public void CheckExistingUser2()
|
||||
{
|
||||
//arrange
|
||||
var list_of_users = new List<User>();
|
||||
setArrangeListOfUsers(ref list_of_users);
|
||||
User u1 = new User() { FirstName = "Adam", LastName = "Kowalski", City = "Warszawa", Pesel = "55122952416" };
|
||||
|
||||
bool conditionBeforeAddUser = CheckConditionOfUserExist(ref list_of_users, u1);
|
||||
bool condition = User.UserExists(ref list_of_users, u1);
|
||||
bool conditionAfterAddUser = CheckConditionOfUserExist(ref list_of_users, u1);
|
||||
|
||||
|
||||
//Assert
|
||||
Assert.IsTrue(condition);
|
||||
Assert.IsTrue(conditionBeforeAddUser);
|
||||
Assert.IsTrue(conditionAfterAddUser);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/// check method equals
|
||||
[TestMethod]
|
||||
public void CheckMethodEquals()
|
||||
{
|
||||
//arrange
|
||||
User user =new User() { FirstName = "Adam", LastName = "Kowalski", City = "Warszawa", Pesel = "55122952416" };
|
||||
User user1= new User() { FirstName = "Adam", LastName = "Kowalski", City = "Warszawa", Pesel = "55122952416" };
|
||||
User user2= new User() { FirstName = "Jan", LastName = "Nowak", City = "Warszawa", Pesel = "71052429624" };
|
||||
Object obj = new Object();
|
||||
|
||||
/// equals
|
||||
bool conditionEquals = user.Equals(user1);
|
||||
|
||||
/// not equals
|
||||
bool conditionNotEquals = user.Equals(user2);
|
||||
|
||||
|
||||
//Assert
|
||||
Assert.IsTrue(conditionEquals);
|
||||
Assert.IsFalse(conditionNotEquals);
|
||||
|
||||
/// throw exception - incorrect comparing object
|
||||
Assert.ThrowsException<Exception>(() => user.Equals(obj));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
BIN
Application/UnitTestProject/bin/Debug/Application.exe
Normal file
BIN
Application/UnitTestProject/bin/Debug/Application.exe
Normal file
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
BIN
Application/UnitTestProject/bin/Debug/Application.pdb
Normal file
BIN
Application/UnitTestProject/bin/Debug/Application.pdb
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
Application/UnitTestProject/bin/Debug/UnitTestProject.dll
Normal file
BIN
Application/UnitTestProject/bin/Debug/UnitTestProject.dll
Normal file
Binary file not shown.
BIN
Application/UnitTestProject/bin/Debug/UnitTestProject.pdb
Normal file
BIN
Application/UnitTestProject/bin/Debug/UnitTestProject.pdb
Normal file
Binary file not shown.
0
Application/UnitTestProject/bin/Debug/file.txt
Normal file
0
Application/UnitTestProject/bin/Debug/file.txt
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
||||
ddfbb83cd4567120ab9f6ec28473dad8c62eff31
|
@ -0,0 +1,17 @@
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\UnitTestProject.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\UnitTestProject.pdb
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Application.exe
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Application.pdb
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Application.exe.config
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.xml
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\bin\Debug\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\obj\Debug\UnitTestProject.csprojAssemblyReference.cache
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\obj\Debug\UnitTestProject.csproj.CoreCompileInputs.cache
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\obj\Debug\UnitTestProject.csproj.CopyComplete
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\obj\Debug\UnitTestProject.dll
|
||||
C:\Users\Dominik\Desktop\project\Application\UnitTestProject\obj\Debug\UnitTestProject.pdb
|
Binary file not shown.
BIN
Application/UnitTestProject/obj/Debug/UnitTestProject.dll
Normal file
BIN
Application/UnitTestProject/obj/Debug/UnitTestProject.dll
Normal file
Binary file not shown.
BIN
Application/UnitTestProject/obj/Debug/UnitTestProject.pdb
Normal file
BIN
Application/UnitTestProject/obj/Debug/UnitTestProject.pdb
Normal file
Binary file not shown.
5
Application/UnitTestProject/packages.config
Normal file
5
Application/UnitTestProject/packages.config
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net472" />
|
||||
</packages>
|
BIN
Application/packages/MSTest.TestAdapter.2.1.0/.signature.p7s
vendored
Normal file
BIN
Application/packages/MSTest.TestAdapter.2.1.0/.signature.p7s
vendored
Normal file
Binary file not shown.
23
Application/packages/MSTest.TestAdapter.2.1.0/LICENSE.txt
vendored
Normal file
23
Application/packages/MSTest.TestAdapter.2.1.0/LICENSE.txt
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
MSTest Framework
|
||||
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
BIN
Application/packages/MSTest.TestAdapter.2.1.0/MSTest.TestAdapter.2.1.0.nupkg
vendored
Normal file
BIN
Application/packages/MSTest.TestAdapter.2.1.0/MSTest.TestAdapter.2.1.0.nupkg
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20
Application/packages/MSTest.TestAdapter.2.1.0/build/net45/MSTest.TestAdapter.props
vendored
Normal file
20
Application/packages/MSTest.TestAdapter.2.1.0/build/net45/MSTest.TestAdapter.props
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
35
Application/packages/MSTest.TestAdapter.2.1.0/build/net45/MSTest.TestAdapter.targets
vendored
Normal file
35
Application/packages/MSTest.TestAdapter.2.1.0/build/net45/MSTest.TestAdapter.targets
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<EnableMSTestV2CopyResources Condition="$(EnableMSTestV2CopyResources) == ''">true</EnableMSTestV2CopyResources>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="GetMSTestV2CultureHierarchy">
|
||||
<!-- Only traversing 5 levels in the culture hierarchy. This is the maximum lenght for all cultures and should be sufficient to get to a culture name that maps to a resource folder we package.
|
||||
The root culture name for all cultures is invariant whose name is ''(empty) and the parent for invariant culture is invariant itself.(https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.parent(v=vs.110).aspx.)
|
||||
So the below code should not break build in any case. -->
|
||||
<ItemGroup>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Name)" />
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Name) != ''"/>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Name) != ''"/>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Name) != ''"/>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Parent.Name) != ''"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- Copy resources over to $(TargetDir) if this is a localized build. -->
|
||||
<Target Name="CopyMSTestV2Resources" BeforeTargets="PrepareForBuild" Condition="$(EnableMSTestV2CopyResources) == 'true'" DependsOnTargets="GetMSTestV2CultureHierarchy">
|
||||
<ItemGroup>
|
||||
<MSTestV2ResourceFiles Include="$(MSBuildThisFileDirectory)..\_common\%(CurrentUICultureHierarchy.Identity)\*resources.dll">
|
||||
<CultureString>%(CurrentUICultureHierarchy.Identity)</CultureString>
|
||||
</MSTestV2ResourceFiles>
|
||||
|
||||
<Content Include="@(MSTestV2ResourceFiles)" Condition="@(MSTestV2ResourceFiles) != ''">
|
||||
<Link>%(MSTestV2ResourceFiles.CultureString)\%(Filename)%(Extension)</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
20
Application/packages/MSTest.TestAdapter.2.1.0/build/netcoreapp1.0/MSTest.TestAdapter.props
vendored
Normal file
20
Application/packages/MSTest.TestAdapter.2.1.0/build/netcoreapp1.0/MSTest.TestAdapter.props
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
Binary file not shown.
20
Application/packages/MSTest.TestAdapter.2.1.0/build/uap10.0/MSTest.TestAdapter.props
vendored
Normal file
20
Application/packages/MSTest.TestAdapter.2.1.0/build/uap10.0/MSTest.TestAdapter.props
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)..\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll">
|
||||
<Link>Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
42
Application/packages/MSTest.TestAdapter.2.1.0/build/uap10.0/MSTest.TestAdapter.targets
vendored
Normal file
42
Application/packages/MSTest.TestAdapter.2.1.0/build/uap10.0/MSTest.TestAdapter.targets
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<EnableMSTestV2CopyResources Condition="$(EnableMSTestV2CopyResources) == ''">true</EnableMSTestV2CopyResources>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="GetMSTestV2CultureHierarchy">
|
||||
<!-- Only traversing 5 levels in the culture hierarchy. This is the maximum lenght for all cultures and should be sufficient to get to a culture name that maps to a resource folder we package.
|
||||
The root culture name for all cultures is invariant whose name is ''(empty) and the parent for invariant culture is invariant itself.(https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.parent(v=vs.110).aspx.)
|
||||
So the below code should not break build in any case. -->
|
||||
<ItemGroup>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Name)" />
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Name)"/>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Name) != ''"/>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Name) != ''"/>
|
||||
<CurrentUICultureHierarchy Include="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Parent.Name)" Condition="$([System.Globalization.CultureInfo]::CurrentUICulture.Parent.Parent.Parent.Parent.Name) != ''"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<!-- Copy resources over to $(TargetDir) if this is a localized build. -->
|
||||
<Target Name="CopyMSTestV2Resources" BeforeTargets="PrepareForBuild" Condition="$(EnableMSTestV2CopyResources) == 'true'" DependsOnTargets="GetMSTestV2CultureHierarchy">
|
||||
|
||||
<PropertyGroup>
|
||||
<CurrentUICultureHierarchy>%(CurrentUICultureHierarchy.Identity)</CurrentUICultureHierarchy>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MSTestV2Files Include="$(MSBuildThisFileDirectory)..\_common\*.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="@(MSTestV2Files->'%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')"
|
||||
Condition="Exists('%(RootDir)%(Directory)$(CurrentUICultureHierarchy)\%(FileName).resources.dll')">
|
||||
<Link>$(CurrentUICultureHierarchy)\%(FileName).resources.dll</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<BaseAssemblyFullPath>%(FullPath)</BaseAssemblyFullPath>
|
||||
<Visible>False</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
Binary file not shown.
BIN
Application/packages/MSTest.TestFramework.2.1.0/.signature.p7s
vendored
Normal file
BIN
Application/packages/MSTest.TestFramework.2.1.0/.signature.p7s
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user