Skip to content

Commit 68b523e

Browse files
committed
Add more tests
1 parent 7c35692 commit 68b523e

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

IntegrationEngine.Tests/Api/Controllers/JobTypeControllerTest.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Moq;
66
using NUnit.Framework;
77
using System;
8+
using System.Linq;
89
using System.Collections;
910
using System.Collections.Generic;
1011

@@ -17,18 +18,18 @@ public void ShouldReturnListOfJobTypes()
1718
{
1819
var engineScheduler = new Mock<EngineScheduler>();
1920
var type = typeof(IntegrationJobFixture);
20-
var expected = new List<JobType>() {
21-
new JobType() {
22-
FullName = type.FullName,
23-
Name = type.Name,
24-
}
21+
var expected = new JobType() {
22+
FullName = type.FullName,
23+
Name = type.Name,
2524
};
2625
engineScheduler.SetupGet(x => x.IntegrationJobTypes).Returns(new List<Type>() { type });
2726
Subject.EngineScheduler = engineScheduler.Object;
2827

2928
var result = Subject.GetJobTypes();
3029

31-
Assert.That(result, Is.EqualTo(expected));
30+
var first = result.First();
31+
Assert.That(first.FullName, Is.EqualTo(expected.FullName));
32+
Assert.That(first.Name, Is.EqualTo(expected.Name));
3233
}
3334
}
3435
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using BeekmanLabs.UnitTesting;
2+
using IntegrationEngine.Api.Controllers;
3+
using IntegrationEngine.Model;
4+
using IntegrationEngine.Scheduler;
5+
using Moq;
6+
using NUnit.Framework;
7+
using System;
8+
using System.Linq;
9+
using System.Collections;
10+
using System.Collections.Generic;
11+
12+
namespace IntegrationEngine.Tests
13+
{
14+
public class TimeZoneControllerTest : TestBase<TimeZoneController>
15+
{
16+
[Test]
17+
public void ShouldReturnListOfTimeZones()
18+
{
19+
var result = Subject.GetTimeZones().ToList();
20+
21+
Assert.That(result.Count, Is.GreaterThan(0));
22+
}
23+
}
24+
}
25+

IntegrationEngine.Tests/IntegrationEngine.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
<Compile Include="Scheduler\EngineSchedulerTest.cs" />
9393
<Compile Include="StubContainer.cs" />
9494
<Compile Include="Api\Controllers\JobTypeControllerTest.cs" />
95+
<Compile Include="Api\Controllers\TimeZoneControllerTest.cs" />
9596
</ItemGroup>
9697
<ItemGroup>
9798
<None Include="..\configuration\IntegrationEngine.json">

IntegrationEngine/Api/Controllers/TimeZoneController.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ public class TimeZoneController : ApiController
1414
public TimeZoneController()
1515
{}
1616

17-
[ResponseType(typeof(ITimeZone))]
18-
public IHttpActionResult GetTimeZones()
17+
public IEnumerable<ITimeZone> GetTimeZones()
1918
{
20-
var timeZones = TimeZoneInfo.GetSystemTimeZones().Select(x => new InEngineTimeZone(x)).ToList();
21-
return Ok(timeZones);
19+
return TimeZoneInfo.GetSystemTimeZones().Select(x => new InEngineTimeZone(x));
2220
}
2321
}
2422
}

0 commit comments

Comments
 (0)