+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
- <CLRTestKind>BuildAndRun</CLRTestKind>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="datetimeformatinfogetabbreviateddayname.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <None Include="project.json" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
- <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib>
- <CLRTestKind>BuildAndRun</CLRTestKind>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <!-- Add Compile Object Here -->
- <Compile Include="datetimeformatinfogetdayname.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="app.config" />
- <None Include="project.json" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
- <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Globalization;
-
-/// <summary>
-/// GetAbbreviatedDayName(System.DayOfWeek)
-/// </summary>
-public class DateTimeFormatInfoGetAbbreviatedDayName
-{
- #region Public Methods
- public bool RunTests()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.LogInformation("[Positive]");
- retVal = PosTest1() && retVal;
- retVal = PosTest2() && retVal;
- retVal = PosTest3() && retVal;
- retVal = PosTest4() && retVal;
-
- TestLibrary.TestFramework.LogInformation("[Negative]");
- retVal = NegTest1() && retVal;
-
- return retVal;
- }
-
- #region Positive Test Cases
- public bool PosTest1()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest1: Call GetAbbreviatedDayName on default invariant DateTimeFormatInfo instance");
-
- try
- {
- DateTimeFormatInfo info = CultureInfo.InvariantCulture.DateTimeFormat;
- string[] expected = new string[] {
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
- };
-
- retVal = VerificationHelper(info, expected, "001.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
-
- public bool PosTest2()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest2: Call GetAbbreviatedDayName on en-us culture DateTimeFormatInfo instance");
-
- try
- {
- DateTimeFormatInfo info = new CultureInfo("en-us").DateTimeFormat;
- string[] expected = new string[] {
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
- };
-
- retVal = VerificationHelper(info, expected, "002.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("002.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
-
- public bool PosTest3()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest3: Call GetAbbreviatedDayName on fr-FR culture DateTimeFormatInfo instance");
-
- try
- {
- DateTimeFormatInfo info = new CultureInfo("fr-FR").DateTimeFormat;
- string[] expected = new string[] {
- "dim.",
- "lun.",
- "mar.",
- "mer.",
- "jeu.",
- "ven.",
- "sam."
- };
-
- retVal = VerificationHelper(info, expected, "003.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("003.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
-
- public bool PosTest4()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest4: Call GetAbbreviatedDayName on DateTimeFormatInfo instance created from ctor");
-
- try
- {
- DateTimeFormatInfo info = new DateTimeFormatInfo();
- string[] expected = new string[] {
- "Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat"
- };
-
- retVal = VerificationHelper(info, expected, "004.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("004.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
- #endregion
-
- #region Nagetive Test Cases
- public bool NegTest1()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("NegTest1: ArgumentOutOfRangeException should be thrown when dayofweek is not a valid System.DayOfWeek value. ");
-
- try
- {
- DateTimeFormatInfo info = new DateTimeFormatInfo();
-
- info.GetAbbreviatedDayName((DayOfWeek)(-1));
-
- TestLibrary.TestFramework.LogError("101.1", "ArgumentOutOfRangeException is not thrown");
- retVal = false;
- }
- catch (ArgumentOutOfRangeException)
- {
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("101.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
- #endregion
- #endregion
-
- public static int Main()
- {
- DateTimeFormatInfoGetAbbreviatedDayName test = new DateTimeFormatInfoGetAbbreviatedDayName();
-
- TestLibrary.TestFramework.BeginTestCase("DateTimeFormatInfoGetAbbreviatedDayName");
-
- if (test.RunTests())
- {
- TestLibrary.TestFramework.EndTestCase();
- TestLibrary.TestFramework.LogInformation("PASS");
- return 100;
- }
- else
- {
- TestLibrary.TestFramework.EndTestCase();
- TestLibrary.TestFramework.LogInformation("FAIL");
- return 0;
- }
- }
-
- #region Private Methods
- private bool VerificationHelper(DateTimeFormatInfo info, string[] expected, string errorno)
- {
- bool retval = true;
-
- DayOfWeek[] values = new DayOfWeek[] {
- DayOfWeek.Sunday,
- DayOfWeek.Monday,
- DayOfWeek.Tuesday,
- DayOfWeek.Wednesday,
- DayOfWeek.Thursday,
- DayOfWeek.Friday,
- DayOfWeek.Saturday
- };
-
- for (int i = 0; i < values.Length; ++i)
- {
- string actual = info.GetAbbreviatedDayName(values[i]);
- if (actual != expected[i])
- {
- TestLibrary.TestFramework.LogError(errorno, "GetAbbreviatedDayName returns wrong value");
- TestLibrary.TestFramework.LogInformation("WARNING[LOCAL VARIABLES] values[i] = " + values[i] + ", expected[i] = " + expected[i] + ", actual = " + actual);
- retval = false;
- }
- }
-
- return retval;
- }
- #endregion
-}
+++ /dev/null
-using System;
-using System.Globalization;
-
-/// <summary>
-/// GetDayName(System.DayOfWeek)
-/// </summary>
-public class DateTimeFormatInfoGetDayName
-{
- #region Public Methods
- public bool RunTests()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.LogInformation("[Positive]");
- retVal = PosTest1() && retVal;
- retVal = PosTest2() && retVal;
- retVal = PosTest3() && retVal;
- retVal = PosTest4() && retVal;
-
- TestLibrary.TestFramework.LogInformation("[Negative]");
- retVal = NegTest1() && retVal;
-
- return retVal;
- }
-
- #region Positive Test Cases
- public bool PosTest1()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest1: Call GetAbbreviatedDayName on default invariant DateTimeFormatInfo instance");
-
- try
- {
- DateTimeFormatInfo info = CultureInfo.InvariantCulture.DateTimeFormat;
- string[] expected = new string[] {
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- };
-
- retVal = VerificationHelper(info, expected, "001.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("001.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
-
- public bool PosTest2()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest2: Call GetAbbreviatedDayName on en-us culture DateTimeFormatInfo instance");
-
- try
- {
- DateTimeFormatInfo info = new CultureInfo("en-us").DateTimeFormat;
- string[] expected = new string[] {
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- };
-
- retVal = VerificationHelper(info, expected, "002.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("002.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
-
- public bool PosTest3()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest3: Call GetAbbreviatedDayName on fr-FR culture DateTimeFormatInfo instance");
-
- try
- {
- DateTimeFormatInfo info = new CultureInfo("fr-FR").DateTimeFormat;
- string[] expected = new string[] {
- "dimanche",
- "lundi",
- "mardi",
- "mercredi",
- "jeudi",
- "vendredi",
- "samedi"
- };
-
- retVal = VerificationHelper(info, expected, "003.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("003.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
-
- public bool PosTest4()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("PosTest4: Call GetAbbreviatedDayName on DateTimeFormatInfo instance created from ctor");
-
- try
- {
- DateTimeFormatInfo info = new DateTimeFormatInfo();
- string[] expected = new string[] {
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday"
- };
-
- retVal = VerificationHelper(info, expected, "004.1") && retVal;
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("004.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
- #endregion
-
- #region Nagetive Test Cases
- public bool NegTest1()
- {
- bool retVal = true;
-
- TestLibrary.TestFramework.BeginScenario("NegTest1: ArgumentOutOfRangeException should be thrown when dayofweek is not a valid System.DayOfWeek value. ");
-
- try
- {
- DateTimeFormatInfo info = new DateTimeFormatInfo();
-
- info.GetAbbreviatedDayName((DayOfWeek)(-1));
-
- TestLibrary.TestFramework.LogError("101.1", "ArgumentOutOfRangeException is not thrown");
- retVal = false;
- }
- catch (ArgumentOutOfRangeException)
- {
- }
- catch (Exception e)
- {
- TestLibrary.TestFramework.LogError("101.0", "Unexpected exception: " + e);
- TestLibrary.TestFramework.LogInformation(e.StackTrace);
- retVal = false;
- }
-
- return retVal;
- }
- #endregion
- #endregion
-
- public static int Main()
- {
- DateTimeFormatInfoGetDayName test = new DateTimeFormatInfoGetDayName();
-
- TestLibrary.TestFramework.BeginTestCase("DateTimeFormatInfoGetDayName");
-
- if (test.RunTests())
- {
- TestLibrary.TestFramework.EndTestCase();
- TestLibrary.TestFramework.LogInformation("PASS");
- return 100;
- }
- else
- {
- TestLibrary.TestFramework.EndTestCase();
- TestLibrary.TestFramework.LogInformation("FAIL");
- return 0;
- }
- }
-
- #region Private Methods
- private bool VerificationHelper(DateTimeFormatInfo info, string[] expected, string errorno)
- {
- bool retval = true;
-
- DayOfWeek[] values = new DayOfWeek[] {
- DayOfWeek.Sunday,
- DayOfWeek.Monday,
- DayOfWeek.Tuesday,
- DayOfWeek.Wednesday,
- DayOfWeek.Thursday,
- DayOfWeek.Friday,
- DayOfWeek.Saturday
- };
-
- for (int i = 0; i < values.Length; ++i)
- {
- string actual = info.GetDayName(values[i]);
- if (actual != expected[i])
- {
- TestLibrary.TestFramework.LogError(errorno, "GetDayName returns wrong value");
- TestLibrary.TestFramework.LogInformation("WARNING[LOCAL VARIABLES] values[i] = " + values[i] + ", expected[i] = " + expected[i] + ", actual = " + actual);
- retval = false;
- }
- }
-
- return retval;
- }
- #endregion
-}