public void MatchCategoryFilterByFilterList() { //given var child = new Model.Category { Name = "a1" }; var parent = new Model.Category { Name = "a2" }; var root = new Model.Category { Name = "a3" }; child.Parent = parent; parent.Parent = root; var filter = new List <Guid> { root.Id, parent.Id }; //when bool childMatchesFilter = child.MatchCategoryFilter(filter); bool parentMatchesFilter = parent.MatchCategoryFilter(filter); bool rootMatchesFilter = root.MatchCategoryFilter(filter); //then Assert.True(childMatchesFilter); Assert.True(parentMatchesFilter); Assert.False(rootMatchesFilter); }
public void MatchCategoryFilter_Null_False() { //given var category = new Model.Category { Name = "a1" }; //when bool result = category.MatchCategoryFilter((Model.Category)null); //then Assert.False(result); }
public void MatchCategoryFilter_ChildToParent_False() { //given var child = new Model.Category { Name = "a1" }; var parent = new Model.Category { Name = "a2" }; child.Parent = parent; //when bool result = child.MatchCategoryFilter(parent); //then Assert.False(result); }
public void MatchCategoryFilter_Child_True() { //given var child = new Model.Category { Name = "a1" }; var parent = new Model.Category { Name = "a2" }; child.Parent = parent; //when bool result = parent.MatchCategoryFilter(child); //then Assert.True(result); }
public void MatchCategoryFilter_NonRelated_False() { //given var child = new Model.Category { Name = "a1" }; var parent = new Model.Category { Name = "a2" }; var random = new Model.Category { Name = "a3" }; child.Parent = parent; //when bool result = parent.MatchCategoryFilter(random); //then Assert.False(result); }