Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

[C#] Namespace concept. Red vs Blue. Tests #2783

Merged
merged 3 commits into from
Nov 17, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class RemoteControlCar
{
public RemoteControlCar(Motor motor, Chassis chassis, Telemetry telemetry)
{

}
// blue members and API
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{
"github_username": "ErikSchierboom",
"exercism_username": "ErikSchierboom"
},
{
"github_username": "valentin-p",
"exercism_username": "valentin-p"
}
],
"authors": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public class Motor
// red members and API
}
}

public static class BlueRemoteControlCarTeam
{
public class RemoteControlCar
{
public RemoteControlCar(Motor motor, Chassis chassis, Telemetry telemetry)
{

}
// blue members and API
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,58 @@
using Combined;
using System;
using Xunit;

public class NamespacesTests
{
[Fact]
public void BuildRed()
public void Namespace_for_CarBuilder_is_Combined()
{
Assert.NotNull(CarBuilder.BuildRed());
var carBuilderType = Type.GetType("Combined.CarBuilder");
Assert.NotNull(carBuilderType);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void BuildBlue()
public void Namespace_for_CarBuilder_has_method_BuildBlue()
{
Assert.NotNull(CarBuilder.BuildBlue());
var carBuilderType = Type.GetType("Combined.CarBuilder");
Assert.NotNull(carBuilderType?.GetMethod("BuildBlue"));
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Namespace_for_CarBuilder_has_method_BuildRed()
{
var carBuilderType = Type.GetType("Combined.CarBuilder");
Assert.NotNull(carBuilderType?.GetMethod("BuildRed"));
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Namespace_for_CarBuilder_returns_Blue_Type()
{
var carBuilderType = Type.GetType("Combined.CarBuilder");
var returnType = carBuilderType?.GetMethod("BuildBlue")?.ReturnType;
Assert.Equal("BlueRemoteControlCarTeam.RemoteControlCar", returnType?.FullName);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Namespace_for_CarBuilder_returns_Red_Type()
{
var carBuilderType = Type.GetType("Combined.CarBuilder");
var returnType = carBuilderType?.GetMethod("BuildRed")?.ReturnType;
Assert.Equal("RedRemoteControlCarTeam.RemoteControlCar", returnType?.FullName);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Namespace_for_CarBuilder_can_BuildBlue_car()
{
var carBuilderType = Type.GetType("Combined.CarBuilder");
var blueRemoteControlCar = carBuilderType?.GetMethod("BuildBlue")?.Invoke(null, null);
Assert.NotNull(blueRemoteControlCar);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Namespace_for_CarBuilder_can_BuildRed_car()
{
var carBuilderType = Type.GetType("Combined.CarBuilder");
var redRemoteControlCar = carBuilderType?.GetMethod("BuildRed")?.Invoke(null, null);
Assert.NotNull(redRemoteControlCar);
}
}