public void Should_Return_Null_If_Cannot_Parse_Values(string startDate, string startTime) { // Given var fixture = new TeamCityInfoFixture(); fixture.SetBuildStartDate(startDate); fixture.SetBuildStartTime(startTime); var info = fixture.CreateBuildInfo(); // When var result = info.StartDateTime; // Then Assert.Equal(null, result); }
public void Should_Use_Build_Server_Local_Time() { // Given var now = DateTime.Now; var startDate = now.ToString("yyyyMMdd", CultureInfo.InvariantCulture); var startTime = now.ToString("HHmmss", CultureInfo.InvariantCulture); var fixture = new TeamCityInfoFixture(); fixture.SetBuildStartDate(startDate); fixture.SetBuildStartTime(startTime); var info = fixture.CreateBuildInfo(); // When var result = info.StartDateTime; // Then var expected = new DateTimeOffset?(new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, DateTimeKind.Local)); Assert.Equal(expected, result); }