public void ValueOneOf4Test() { string str; var item1 = ValueOneOf <Case1, Case2, Case3, Case4> .Create(new Case1()); Assert.AreEqual("Case1", item1.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item1.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case1", str); var item2 = ValueOneOf <Case1, Case2, Case3, Case4> .Create(new Case2()); Assert.AreEqual("Case2", item2.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item2.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case2", str); var item3 = ValueOneOf <Case1, Case2, Case3, Case4> .Create(new Case3()); Assert.AreEqual("Case3", item3.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item3.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case3", str); var item4 = ValueOneOf <Case1, Case2, Case3, Case4> .Create(new Case4()); Assert.AreEqual("Case4", item4.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item4.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case4", str); }
public void ValueOneOf7Test() { string str; var item1 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case1()); Assert.AreEqual("Case1", item1.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item1.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case1", str); var item2 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case2()); Assert.AreEqual("Case2", item2.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item2.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case2", str); var item3 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case3()); Assert.AreEqual("Case3", item3.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item3.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case3", str); var item4 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case4()); Assert.AreEqual("Case4", item4.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item4.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case4", str); var item5 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case5()); Assert.AreEqual("Case5", item5.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item5.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case5", str); var item6 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case6()); Assert.AreEqual("Case6", item6.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item6.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case6", str); var item7 = ValueOneOf <Case1, Case2, Case3, Case4, Case5, Case6, Case7> .Create(new Case7()); Assert.AreEqual("Case7", item7.GetValue(v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name, v => v.Name)); str = ""; item7.Do(v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name, v => str = v.Name); Assert.AreEqual("Case7", str); }