From 56907ae1aad10f03965e6fa1732f46fe649e23d4 Mon Sep 17 00:00:00 2001 From: Jim Paine Date: Wed, 6 May 2020 14:38:35 +0100 Subject: [PATCH] made query consistent --- Project.Zap.Tests/ShiftsControllerTests.cs | 4 ++-- Project.Zap/Controllers/ShiftsController.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.Zap.Tests/ShiftsControllerTests.cs b/Project.Zap.Tests/ShiftsControllerTests.cs index 9a83cb0..ce04441 100644 --- a/Project.Zap.Tests/ShiftsControllerTests.cs +++ b/Project.Zap.Tests/ShiftsControllerTests.cs @@ -270,7 +270,7 @@ namespace Project.Zap.Tests } [Fact] - public async Task ViewShifts_Shifts_AfterToday() + public async Task ViewShifts_Shifts_AfterOrEqualToNow() { // Arrange IRepository shiftRepository = Substitute.For>(); @@ -285,7 +285,7 @@ namespace Project.Zap.Tests // Assert #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed shiftRepository.Received(1).Get( - "SELECT * FROM c WHERE c.EmployeeId = @employeeId AND c.StartDateTime > @start", + "SELECT * FROM c WHERE c.EmployeeId = @employeeId AND c.StartDateTime >= @start", Arg.Is>(x => x.ContainsKey("@employeeId") && x.ContainsKey("@start"))); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed } diff --git a/Project.Zap/Controllers/ShiftsController.cs b/Project.Zap/Controllers/ShiftsController.cs index 53be0c8..f8363e3 100644 --- a/Project.Zap/Controllers/ShiftsController.cs +++ b/Project.Zap/Controllers/ShiftsController.cs @@ -171,7 +171,7 @@ namespace Project.Zap.Controllers } IEnumerable shifts = await this.shiftRepository.Get( - "SELECT * FROM c WHERE c.EmployeeId = @employeeId AND c.StartDateTime > @start", + "SELECT * FROM c WHERE c.EmployeeId = @employeeId AND c.StartDateTime >= @start", new Dictionary { { "@employeeId", id.Value }, { "@start", DateTime.Now } }); if (shifts?.Any() == false)