From baca7ea2dd3f7c4ad204c139bd0219e843d3b7de Mon Sep 17 00:00:00 2001 From: eebbesen Date: Tue, 29 Oct 2024 06:57:14 -0500 Subject: [PATCH] linter remediation --- .../StpFoodBlazor/Helpers/DealFilter.cs | 18 +++++++++--------- .../Helpers/DealFilterTest.cs | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/StpFoodBlazor/StpFoodBlazor/Helpers/DealFilter.cs b/StpFoodBlazor/StpFoodBlazor/Helpers/DealFilter.cs index 228c543..86ada13 100644 --- a/StpFoodBlazor/StpFoodBlazor/Helpers/DealFilter.cs +++ b/StpFoodBlazor/StpFoodBlazor/Helpers/DealFilter.cs @@ -8,7 +8,7 @@ public class DealFilter { public bool? Alcohol { get; set; } public bool? HappyHour { get; set; } - public DealEvent[] filter() { + public DealEvent[] Filter() { if (Deals == null) { return []; } @@ -16,33 +16,33 @@ public DealEvent[] filter() { DealEvent[] filteredDeals = Deals; if (!string.IsNullOrWhiteSpace(Day)) { - filteredDeals = filterByDay(filteredDeals, Day); + filteredDeals = FilterByDay(filteredDeals, Day); } if (!string.IsNullOrWhiteSpace(Name)) { - filteredDeals = filterByName(filteredDeals, Name); + filteredDeals = FilterByName(filteredDeals, Name); } if (Alcohol != null) { - filteredDeals = filterByAlcohol(filteredDeals, (bool)Alcohol); + filteredDeals = FilterByAlcohol(filteredDeals, (bool)Alcohol); } if(HappyHour != null) { - filteredDeals = filterByHappyHour(filteredDeals, (bool)HappyHour); + filteredDeals = FilterByHappyHour(filteredDeals, (bool)HappyHour); } return filteredDeals; } - private static DealEvent[] filterByDay(DealEvent[] deals, String day) { + private static DealEvent[] FilterByDay(DealEvent[] deals, String day) { return deals.Where(deal => deal.Day == day).ToArray(); } - private static DealEvent[] filterByName(DealEvent[] deals, String name) { + private static DealEvent[] FilterByName(DealEvent[] deals, String name) { return deals.Where(deal => deal.Name == name).ToArray(); } - private static DealEvent[] filterByAlcohol(DealEvent[] deals, Boolean alcohol) { + private static DealEvent[] FilterByAlcohol(DealEvent[] deals, Boolean alcohol) { if (alcohol) { return deals.Where(deal => !string.IsNullOrWhiteSpace(deal.Alcohol)).ToArray(); } @@ -51,7 +51,7 @@ private static DealEvent[] filterByAlcohol(DealEvent[] deals, Boolean alcohol) { } // Need to convert column header with space to model attribute without one - private static DealEvent[] filterByHappyHour(DealEvent[] deals, Boolean happyHour) { + private static DealEvent[] FilterByHappyHour(DealEvent[] deals, Boolean happyHour) { if (happyHour) { return deals.Where(deal => deal.HappyHour != null && deal.HappyHour.Trim() != "").ToArray(); diff --git a/StpFoodBlazor/StpFoodBlazorTest/Helpers/DealFilterTest.cs b/StpFoodBlazor/StpFoodBlazorTest/Helpers/DealFilterTest.cs index 4ffd661..4ed614c 100644 --- a/StpFoodBlazor/StpFoodBlazorTest/Helpers/DealFilterTest.cs +++ b/StpFoodBlazor/StpFoodBlazorTest/Helpers/DealFilterTest.cs @@ -17,7 +17,7 @@ public DealFilterTest() { [Fact] public void ShouldHandleEmptyDeals() { - DealEvent[] filteredDeals = new DealFilter().filter(); + DealEvent[] filteredDeals = new DealFilter().Filter(); Assert.Empty(filteredDeals); } @@ -26,7 +26,7 @@ public void ShouldHandleEmptyDeals() { public void ShouldReturnInputWhenNoFilterConditions() { int dealsLength = deals.Length; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(324, dealsLength); Assert.Equal(dealsLength, filteredDeals.Length); @@ -37,7 +37,7 @@ public void ShouldReturnFilteredByDay() { String day = "Monday"; filter.Day = day; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(45, filteredDeals.Length); Array.ForEach(filteredDeals, deal => Assert.Equal(day, deal.Day)); @@ -48,7 +48,7 @@ public void ShouldReturnFilteredByName() { String name = "Pino's Pizza"; filter.Name = name; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(5, filteredDeals.Length); Array.ForEach(filteredDeals, deal => Assert.Equal(name, deal.Name)); @@ -61,7 +61,7 @@ public void ShouldReturnFilteredByNameAndDay() { filter.Name = name; filter.Day = day; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Single(filteredDeals); Array.ForEach(filteredDeals, deal => { @@ -74,7 +74,7 @@ public void ShouldReturnFilteredByNameAndDay() { public void ShouldReturnFilteredByAlcoholTrue() { filter.Alcohol = true; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(109, filteredDeals.Length); Array.ForEach(filteredDeals, deal => { @@ -86,7 +86,7 @@ public void ShouldReturnFilteredByAlcoholTrue() { public void ShouldReturnFilteredByAlcoholFalse() { filter.Alcohol = false; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(215, filteredDeals.Length); Array.ForEach(filteredDeals, deal => { @@ -98,7 +98,7 @@ public void ShouldReturnFilteredByAlcoholFalse() { public void ShouldReturnFilteredByHappyHourTrue() { filter.HappyHour = true; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(191, filteredDeals.Length); Array.ForEach(filteredDeals, deal => Assert.NotNull(deal.HappyHour)); @@ -108,7 +108,7 @@ public void ShouldReturnFilteredByHappyHourTrue() { public void ShouldReturnFilteredByHappyHourFalse() { filter.HappyHour = false; - DealEvent[] filteredDeals = filter.filter(); + DealEvent[] filteredDeals = filter.Filter(); Assert.Equal(133, filteredDeals.Length); Array.ForEach(filteredDeals, deal =>