Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/BerlinClock/v16/.suo
Binary file not shown.
Empty file.
Binary file added .vs/BerlinClock/v16/Server/sqlite3/storage.ide
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/BerlinClock/v16/TestStore/0/testlog.manifest
Binary file not shown.
Binary file added .vs/EPAM/v16/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
8 changes: 8 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\Classes"
],
"SelectedNode": "\\BerlinClock.sln",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
3 changes: 1 addition & 2 deletions BDD/BerlinClockFeatureSteps.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using TechTalk.SpecFlow;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;

namespace BerlinClock
{
Expand All @@ -21,7 +20,7 @@ public void WhenTheTimeIs(string time)
[Then(@"the clock should look like")]
public void ThenTheClockShouldLookLike(string theExpectedBerlinClockOutput)
{
Assert.AreEqual(berlinClock.convertTime(theTime), theExpectedBerlinClockOutput);
Assert.AreEqual(theExpectedBerlinClockOutput, berlinClock.convertTime(theTime));
}

}
Expand Down
2 changes: 2 additions & 0 deletions BerlinClock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BDD\BerlinClockFeatureSteps.cs" />
<Compile Include="Classes\BerlinClockImpl.cs" />
<Compile Include="Classes\ITimeFormat.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BDD\BerlinClockFeatureSteps.feature.cs">
<AutoGen>True</AutoGen>
Expand Down
13 changes: 11 additions & 2 deletions BerlinClock.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
# Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BerlinClock", "BerlinClock.csproj", "{0451204D-BF86-43E1-B560-FC9AC830B9A9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BerlinClockUnitTests", "BerlinClockUnitTests\BerlinClockUnitTests.csproj", "{EA813377-BCE1-493E-B513-C14A9C99838B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,8 +17,15 @@ Global
{0451204D-BF86-43E1-B560-FC9AC830B9A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0451204D-BF86-43E1-B560-FC9AC830B9A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0451204D-BF86-43E1-B560-FC9AC830B9A9}.Release|Any CPU.Build.0 = Release|Any CPU
{EA813377-BCE1-493E-B513-C14A9C99838B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA813377-BCE1-493E-B513-C14A9C99838B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA813377-BCE1-493E-B513-C14A9C99838B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA813377-BCE1-493E-B513-C14A9C99838B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B88CF40C-E3CA-49EB-AAC1-9CB7836BA300}
EndGlobalSection
EndGlobal
143 changes: 143 additions & 0 deletions BerlinClockUnitTests/BerlinClockTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
using System;
using BerlinClock.Classes;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BerlinClock.UnitTests
{
[TestClass]
public class BerlinClockImplTest
{
[TestMethod]
public void TestFistRowOfLampsIsLit()
{
//Test if first row lamp is switched off
string aTime = "13:00:01";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("O", clock.FirstRow());
}

[TestMethod]
public void TestFistRowOfLampsIsOff()
{
//Test if first row lamp is switched on
string aTime = "13:00:02";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("Y", clock.FirstRow());
}

[TestMethod]
public void TestSecondRowOfLampsIsLit()
{
//Test if second row lamps are all switched on
string aTime = "21:50:02";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("RRRR", clock.SecondRow());
}

[TestMethod]
public void TestSecondRowOfLampsIsOff()
{
//Test if second row lamps are all switched off
string aTime = "04:03:02";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("OOOO", clock.SecondRow());
}

[TestMethod]
public void TestThirdRowOfLampsIsLit()
{
//Test if third row lamps are all switched on
string aTime = "04:59:59";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("RRRR", clock.ThirdRow());
}

[TestMethod]
public void TestThirdRowOfLampsIsOff()
{
//Test if third row lamps are all switched off
string aTime = "00:00:00";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("OOOO", clock.ThirdRow());
}


[TestMethod]
public void TestFourthRowOfLampsIsLit()
{
//Test if fourth row lamps are all switched on
string aTime = "04:59:59";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("YYRYYRYYRYY", clock.FourthRow());
}

[TestMethod]
public void TestFourthRowOfLampsIsOff()
{
//Test if fourth row lamps are all switched off
string aTime = "00:04:00";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("OOOOOOOOOOO", clock.FourthRow());
}

[TestMethod]
public void TestFifthRowOfLampsIsLit()
{
//Test if fourth row lamps are all switched on
string aTime = "08:59:59";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("YYYY", clock.FifthRow());
}

[TestMethod]
public void TestFifthRowOfLampsIsOff()
{
//Test if fourth row lamps are all switched off
string aTime = "00:05:00";

BerlinClockImpl clock = new BerlinClockImpl(aTime);

Assert.AreEqual("OOOO", clock.FifthRow());
}

[TestMethod]
public void TestInvalidTimeFormat()
{
//Test if invalid format throws a ArgumentException
string aTime = "24:05:00";

BerlinClockImpl clock;

Assert.ThrowsException<ArgumentException>(() => clock = new BerlinClockImpl(aTime));
}

[TestMethod]
public void TestMidnight2400()
{
//Test if special case works (24:00:00). In this case, the second row must be RRRR and not OOOO
string aTime = "24:00:00";

BerlinClockImpl clock = new BerlinClockImpl(aTime); ;

Assert.AreEqual("RRRR", clock.SecondRow());
}
}
}
74 changes: 74 additions & 0 deletions BerlinClockUnitTests/BerlinClockUnitTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?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.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\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>{EA813377-BCE1-493E-B513-C14A9C99838B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BerlinClockUnitTests</RootNamespace>
<AssemblyName>BerlinClockUnitTests</AssemblyName>
<TargetFrameworkVersion>v4.5</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.1.3.2\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.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="BerlinClockTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BerlinClock.csproj">
<Project>{0451204d-bf86-43e1-b560-fc9ac830b9a9}</Project>
<Name>BerlinClock</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>Este projeto faz referência a pacotes do NuGet que não estão presentes neste computador. Use a Restauração de Pacotes do NuGet para baixá-los. Para obter mais informações, consulte http://go.microsoft.com/fwlink/?LinkID=322105. O arquivo ausente é {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
</Project>
20 changes: 20 additions & 0 deletions BerlinClockUnitTests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("BerlinClockUnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BerlinClockUnitTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]

[assembly: Guid("ea813377-bce1-493e-b513-c14a9c99838b")]

// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Binary file added BerlinClockUnitTests/bin/Debug/BerlinClock.dll
Binary file not shown.
12 changes: 12 additions & 0 deletions BerlinClockUnitTests/bin/Debug/BerlinClock.dll.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<specFlow>
<unitTestProvider name="MsTest" />
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --></specFlow>
</configuration>
Binary file added BerlinClockUnitTests/bin/Debug/BerlinClock.pdb
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.
Loading