public void BasicUsagePasses() { var query = ".style1"; var layoutValueDict = new ViewLayoutValueDictionary() .AddValue("key", 100) .AddValue("key2", 200); var layoutValueDict2 = new ViewLayoutValueDictionary() .AddValue("apple", -100) .AddValue("orange", -200); var layoutOverwriter = new ViewLayoutOverwriter(); layoutOverwriter .Add(new ViewLayoutSelector(query, ""), layoutValueDict) .Add(new ViewLayoutSelector($"Model {query}", ""), layoutValueDict2); var model = new Model() { Name = "Model" } .AddStylingID(query); AssertionUtils.AssertEnumerable( new ViewLayoutValueDictionary[] { layoutValueDict2, layoutValueDict, } , layoutOverwriter.MatchLayoutValueDicts(model, null) , ""); }
public void BasicUsageWithViewObjPasses() { var query = ".style1"; var viewID = "view1"; var viewID2 = "view2"; var layoutValueDict = new ViewLayoutValueDictionary() .AddValue("key", 100) .AddValue("key2", 200); var layoutValueDict2 = new ViewLayoutValueDictionary() .AddValue("apple", -100) .AddValue("orange", -200); var layoutValueDict3 = new ViewLayoutValueDictionary() .AddValue("grape", -100); var layoutOverwriter = new ViewLayoutOverwriter(); layoutOverwriter .Add(new ViewLayoutSelector(query, viewID), layoutValueDict) .Add(new ViewLayoutSelector($"Model {query}", viewID), layoutValueDict2) .Add(new ViewLayoutSelector($"Model {query}", viewID2), layoutValueDict3); var model = new Model() { Name = "Model" } .AddStylingID(query); var viewObj = new EmptyViewObject(); viewObj.Bind(model, new ModelViewBinder.BindInfo(viewID, typeof(EmptyViewObject)), null); AssertionUtils.AssertEnumerable( new ViewLayoutValueDictionary[] { layoutValueDict2, layoutValueDict, } , layoutOverwriter.MatchLayoutValueDicts(model, viewObj) , ""); }