public async Task WorkingForNoon_Kua30_InPause() { var theDay = new DateTime(2020, 6, 22); ctx.TimeBookings.RemoveRange(); await ctx.SaveChangesAsync(); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(6).AddMinutes(3) }); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(9).AddMinutes(0) }); await ctx.SaveChangesAsync(); theDay = theDay.AddHours(10); var(awt, twt) = prepare(theDay); var sut = new InfoService2(awt, twt, config); var res = await sut.LoadInfoAsync(theDay); res.Worked.Should().Be(TimeSpan.FromHours(2).Add(TimeSpan.FromMinutes(57))); res.Pause.Should().Be(TimeSpan.Zero); res.PauseTargetDiff.Should().Be(TimeSpan.FromMinutes(-30)); res.KuaActual.Should().Be(TimeSpan.FromMinutes(315)); res.KuaDiff.Should().Be(TimeSpan.FromMinutes(227.25)); res.VAZ.Should().Be(TimeSpan.Zero); }
public async Task Kua30AlreadyHomeLessKua() { var theDay = new DateTime(2020, 6, 22); ctx.TimeBookings.RemoveRange(); await ctx.SaveChangesAsync(); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(6).AddMinutes(3) }); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(9).AddMinutes(0) }); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(9).AddMinutes(10) }); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(11).AddMinutes(0) }); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(11).AddMinutes(30) }); ctx.TimeBookings.Add(new TimeBooking { BookingTime = theDay.AddHours(14).AddMinutes(45) }); await ctx.SaveChangesAsync(); var(awt, twt) = prepare(theDay); var sut = new InfoService2(awt, twt, config); var res = await sut.LoadInfoAsync(theDay); res.Worked.Should().Be(TimeSpan.FromHours(8).Add(TimeSpan.FromMinutes(2))); res.Pause.Should().Be(TimeSpan.FromMinutes(30)); res.PauseTargetDiff.Should().Be(TimeSpan.FromMinutes(10)); res.KuaActual.Should().Be(TimeSpan.FromMinutes(10)); res.KuaDiff.Should().Be(TimeSpan.FromMinutes(-77.75)); res.VAZ.Should().Be(TimeSpan.Zero); }