Skip to content

Commit 91154f0

Browse files
committed
And added client classes to the Unicode File To Html TextConverter exercise, to better simulate real-life scenarios with dependencies on classes refactored.
1 parent 09cbf60 commit 91154f0

File tree

8 files changed

+114
-0
lines changed

8 files changed

+114
-0
lines changed

TDDMicroExercises.ProposedSolution/CSharp/TDDMicroExercises.OneSolution.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<Reference Include="nunit.framework">
4040
<HintPath>lib\nunit.framework.dll</HintPath>
4141
</Reference>
42+
<Reference Include="Microsoft.CSharp" />
4243
</ItemGroup>
4344
<ItemGroup>
4445
<Compile Include="TelemetrySystem.Tests\MockTelemetryDataChannel.cs" />
@@ -69,6 +70,9 @@
6970
<Compile Include="TirePressureMonitoringSystem.SomeDependencies\AnAlarmClient1.cs" />
7071
<Compile Include="TirePressureMonitoringSystem.SomeDependencies\AnAlarmClient2.cs" />
7172
<Compile Include="TirePressureMonitoringSystem.SomeDependencies\AnAlarmClient3.cs" />
73+
<Compile Include="UnicodeFileToHtmlTextConverter.SomeDependencies\aTextConverterClient1.cs" />
74+
<Compile Include="UnicodeFileToHtmlTextConverter.SomeDependencies\aTextConverterClient2.cs" />
75+
<Compile Include="UnicodeFileToHtmlTextConverter.SomeDependencies\aTextConverterClient3.cs" />
7276
</ItemGroup>
7377
<ItemGroup>
7478
<Folder Include="Properties\" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmlTextConverter.SomeDependencies
2+
{
3+
public class aTextConverterClient1
4+
{
5+
// A class with the only goal of simulating a dependency on UnicodeFileToHtmTextConverter
6+
// that has impact on the refactoring.
7+
8+
public aTextConverterClient1()
9+
{
10+
var filename = "aFilename.txt";
11+
var textConverter = new UnicodeFileToHtmTextConverter.UnicodeFileToHtmTextConverter(filename);
12+
var html = textConverter.ConvertToHtml();
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmlTextConverter.SomeDependencies
2+
{
3+
public class aTextConverterClient2
4+
{
5+
// A class with the only goal of simulating a dependency on UnicodeFileToHtmTextConverter
6+
// that has impact on the refactoring.
7+
8+
UnicodeFileToHtmTextConverter.UnicodeFileToHtmTextConverter _textConverter;
9+
10+
public aTextConverterClient2()
11+
{
12+
_textConverter = new TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter.UnicodeFileToHtmTextConverter("anotherFilename.txt");
13+
14+
var html = _textConverter.ConvertToHtml();
15+
}
16+
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
3+
namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmlTextConverter.SomeDependencies
4+
{
5+
public class aTextConverterClient3
6+
{
7+
// A class with the only goal of simulating a dependency on UnicodeFileToHtmTextConverter
8+
// that has impact on the refactoring.
9+
10+
public aTextConverterClient3()
11+
{
12+
object[] args = {"jetAnotherFilename.txt"};
13+
dynamic x = Activator.CreateInstance(Type.GetType("TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter.UnicodeFileToHtmTextConverter"), args);
14+
15+
string html = x.ConvertToHtml();
16+
}
17+
}
18+
}

TDDMicroExercises/CSharp/TDDMicroExercises.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<Reference Include="nunit.framework">
4040
<HintPath>lib\nunit.framework.dll</HintPath>
4141
</Reference>
42+
<Reference Include="Microsoft.CSharp" />
4243
</ItemGroup>
4344
<ItemGroup>
4445
<Compile Include="TelemetrySystem\TelemetryClient.cs" />
@@ -54,10 +55,14 @@
5455
<Compile Include="TirePressureMonitoringSystem.SomeDependencies\AnAlarmClient1.cs" />
5556
<Compile Include="TirePressureMonitoringSystem.SomeDependencies\AnAlarmClient3.cs" />
5657
<Compile Include="TirePressureMonitoringSystem.SomeDependencies\AnAlarmClient2.cs" />
58+
<Compile Include="UnicodeFileToHtmlTextConverter.SomeDependencies\aTextConverterClient1.cs" />
59+
<Compile Include="UnicodeFileToHtmlTextConverter.SomeDependencies\aTextConverterClient2.cs" />
60+
<Compile Include="UnicodeFileToHtmlTextConverter.SomeDependencies\aTextConverterClient3.cs" />
5761
</ItemGroup>
5862
<ItemGroup>
5963
<Folder Include="Properties\" />
6064
<Folder Include="TirePressureMonitoringSystem.SomeDependencies\" />
65+
<Folder Include="UnicodeFileToHtmlTextConverter.SomeDependencies\" />
6166
</ItemGroup>
6267
<ItemGroup>
6368
<None Include="lib\nunit.framework.dll" />
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
namespace TDDMicroExercises.UnicodeFileToHtmlTextConverter.SomeDependencies
3+
{
4+
public class aTextConverterClient1
5+
{
6+
// A class with the only goal of simulating a dependency on UnicodeFileToHtmTextConverter
7+
// that has impact on the refactoring.
8+
9+
public aTextConverterClient1()
10+
{
11+
var filename = "aFilename.txt";
12+
var textConverter = new UnicodeFileToHtmlTextConverter(filename);
13+
var html = textConverter.ConvertToHtml();
14+
}
15+
}
16+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
namespace TDDMicroExercises.UnicodeFileToHtmlTextConverter.SomeDependencies
3+
{
4+
public class aTextConverterClient2
5+
{
6+
// A class with the only goal of simulating a dependency on UnicodeFileToHtmTextConverter
7+
// that has impact on the refactoring.
8+
9+
10+
UnicodeFileToHtmlTextConverter _textConverter;
11+
12+
public aTextConverterClient2()
13+
{
14+
_textConverter = new UnicodeFileToHtmlTextConverter("anotherFilename.txt");
15+
16+
var html = _textConverter.ConvertToHtml();
17+
}
18+
19+
}
20+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
namespace TDDMicroExercises.UnicodeFileToHtmlTextConverter.SomeDependencies
3+
{
4+
public class aTextConverterClient3
5+
{
6+
// A class with the only goal of simulating a dependency on UnicodeFileToHtmTextConverter
7+
// that has impact on the refactoring.
8+
9+
public aTextConverterClient3()
10+
{
11+
object[] args = { "jetAnotherFilename.txt" };
12+
dynamic x = Activator.CreateInstance(Type.GetType("TDDMicroExercises.UnicodeFileToHtmTextConverter.UnicodeFileToHtmTextConverter"), args);
13+
14+
string html = x.ConvertToHtml();
15+
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)