Esempio n. 1
0
        public virtual void TestMapInterfaceOrTimelineRecords()
        {
            TimelineEntity entity = new TimelineEntity();
            IList <IDictionary <string, ICollection <object> > > primaryFiltersList = new AList <IDictionary
                                                                                                 <string, ICollection <object> > >();

            primaryFiltersList.AddItem(Sharpen.Collections.SingletonMap("pkey", Sharpen.Collections
                                                                        .Singleton((object)"pval")));
            IDictionary <string, ICollection <object> > primaryFilters = new SortedDictionary <string
                                                                                               , ICollection <object> >();

            primaryFilters["pkey1"] = Sharpen.Collections.Singleton((object)"pval1");
            primaryFilters["pkey2"] = Sharpen.Collections.Singleton((object)"pval2");
            primaryFiltersList.AddItem(primaryFilters);
            entity.SetPrimaryFilters(null);
            foreach (IDictionary <string, ICollection <object> > primaryFiltersToSet in primaryFiltersList)
            {
                entity.SetPrimaryFilters(primaryFiltersToSet);
                AssertPrimaryFilters(entity);
                IDictionary <string, ICollection <object> > primaryFiltersToAdd = new WeakHashMap <string
                                                                                                   , ICollection <object> >();
                primaryFiltersToAdd["pkey3"] = Sharpen.Collections.Singleton((object)"pval3");
                entity.AddPrimaryFilters(primaryFiltersToAdd);
                AssertPrimaryFilters(entity);
            }
            IList <IDictionary <string, ICollection <string> > > relatedEntitiesList = new AList <IDictionary
                                                                                                  <string, ICollection <string> > >();

            relatedEntitiesList.AddItem(Sharpen.Collections.SingletonMap("rkey", Sharpen.Collections
                                                                         .Singleton("rval")));
            IDictionary <string, ICollection <string> > relatedEntities = new SortedDictionary <string
                                                                                                , ICollection <string> >();

            relatedEntities["rkey1"] = Sharpen.Collections.Singleton("rval1");
            relatedEntities["rkey2"] = Sharpen.Collections.Singleton("rval2");
            relatedEntitiesList.AddItem(relatedEntities);
            entity.SetRelatedEntities(null);
            foreach (IDictionary <string, ICollection <string> > relatedEntitiesToSet in relatedEntitiesList)
            {
                entity.SetRelatedEntities(relatedEntitiesToSet);
                AssertRelatedEntities(entity);
                IDictionary <string, ICollection <string> > relatedEntitiesToAdd = new WeakHashMap <string
                                                                                                    , ICollection <string> >();
                relatedEntitiesToAdd["rkey3"] = Sharpen.Collections.Singleton("rval3");
                entity.AddRelatedEntities(relatedEntitiesToAdd);
                AssertRelatedEntities(entity);
            }
            IList <IDictionary <string, object> > otherInfoList = new AList <IDictionary <string,
                                                                                          object> >();

            otherInfoList.AddItem(Sharpen.Collections.SingletonMap("okey", (object)"oval"));
            IDictionary <string, object> otherInfo = new SortedDictionary <string, object>();

            otherInfo["okey1"] = "oval1";
            otherInfo["okey2"] = "oval2";
            otherInfoList.AddItem(otherInfo);
            entity.SetOtherInfo(null);
            foreach (IDictionary <string, object> otherInfoToSet in otherInfoList)
            {
                entity.SetOtherInfo(otherInfoToSet);
                AssertOtherInfo(entity);
                IDictionary <string, object> otherInfoToAdd = new WeakHashMap <string, object>();
                otherInfoToAdd["okey3"] = "oval3";
                entity.AddOtherInfo(otherInfoToAdd);
                AssertOtherInfo(entity);
            }
            TimelineEvent @event = new TimelineEvent();
            IList <IDictionary <string, object> > eventInfoList = new AList <IDictionary <string,
                                                                                          object> >();

            eventInfoList.AddItem(Sharpen.Collections.SingletonMap("ekey", (object)"eval"));
            IDictionary <string, object> eventInfo = new SortedDictionary <string, object>();

            eventInfo["ekey1"] = "eval1";
            eventInfo["ekey2"] = "eval2";
            eventInfoList.AddItem(eventInfo);
            @event.SetEventInfo(null);
            foreach (IDictionary <string, object> eventInfoToSet in eventInfoList)
            {
                @event.SetEventInfo(eventInfoToSet);
                AssertEventInfo(@event);
                IDictionary <string, object> eventInfoToAdd = new WeakHashMap <string, object>();
                eventInfoToAdd["ekey3"] = "eval3";
                @event.AddEventInfo(eventInfoToAdd);
                AssertEventInfo(@event);
            }
        }
Esempio n. 2
0
 public override IDictionary <K1, V1> SetMap <K1, V1>(IDictionary <K1, V1> map)
 {
     map = new WeakHashMap <K1, V1>();
     return(map);
 }
 public override IDictionary <K1, V1> SetMap <K1, V1>(IDictionary <K1, V1> map, int initCapacity)
 {
     map = new WeakHashMap <K1, V1>(initCapacity);
     return(map);
 }