Skip to content

Commit

Permalink
Fixed a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMaz committed Jul 9, 2018
1 parent 96947b2 commit 4400019
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Tests/Nop.Services.Tests/TestDiscountService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Caching.Memory;
using Moq;
Expand Down Expand Up @@ -50,7 +51,12 @@ public override IList<DiscountForCaching> GetAllDiscountsForCaching(DiscountType
string couponCode = null, string discountName = null,
bool showHidden = false)
{
return _discountForCaching;

return _discountForCaching
.Where(x=> !discountType.HasValue || x.DiscountType == discountType.Value)
.Where(x => String.IsNullOrEmpty(couponCode) || x.CouponCode == couponCode)
//UNDONE other filtering such as discountName, showHidden (not actually required in unit tests)
.ToList();
}

public void AddDiscount(DiscountType discountType)
Expand Down

0 comments on commit 4400019

Please sign in to comment.