public virtual void ShouldAdaptListCorrectly() { LIST <ST, string> list = new LISTImpl <ST, string>(typeof(STImpl)); list.RawList().Add("text1"); list.RawList().Add("text2"); BareANY adapted = this.adapter.Adapt("SET<TN>", list); Assert.IsTrue(adapted is SET <TNImpl, TrivialName>, "type"); LinkedSet <TNImpl> set = (LinkedSet <TNImpl>)adapted.BareValue; Assert.AreEqual(2, set.Count, "size"); Assert.IsTrue(EveryItemTN(set), "all TNs"); Assert.IsTrue(HasItemWithValue(set, "text1")); Assert.IsTrue(HasItemWithValue(set, "text2")); }
public virtual void TestConvertToBareANYCollectionType() { var first = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP); var second = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.DECALITRE); var third = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.GALLON); LIST <CD_R2 <UnitsOfMeasureCaseSensitive>, CodedTypeR2 <UnitsOfMeasureCaseSensitive> > list = new LISTImpl <CD_R2 <UnitsOfMeasureCaseSensitive>, CodedTypeR2 <UnitsOfMeasureCaseSensitive> >(typeof(CD_R2Impl <UnitsOfMeasureCaseSensitive>)); list.RawList().Add(first); list.RawList().Add(second); list.RawList().Add(third); ICollection <BareANY> bareANYCollection = GenericClassUtil.ConvertToBareANYCollection(list); IEnumerator <BareANY> enumerator = bareANYCollection.GetEnumerator(); enumerator.MoveNext(); Assert.AreSame(first, enumerator.Current.BareValue); enumerator.MoveNext(); Assert.AreSame(second, enumerator.Current.BareValue); enumerator.MoveNext(); Assert.AreSame(third, enumerator.Current.BareValue); }