public static Option ToOption(this IMutableDictionary dico)
        {
            Option option = new Option()
            {
                Id = dico.GetString("id"),
                ProgrammeReserve  = dico.GetDictionary("programmeReserve").ToProgramme(),
                LotReserve        = dico.GetDictionary("lotReserve").ToLot(),
                TiersVendeur      = dico.GetDictionary("tiersVendeur").ToVendeur(),
                NomAcquereur      = dico.GetString("nomAcquereur"),
                Commentaire       = dico.GetString("commentaire"),
                Actif             = dico.Contains("actif") ? dico.GetBoolean("actif") : true,
                TiersConstructeur = dico.Contains("tiersConstructeur") ?  dico.GetDictionary("tiersConstructeur").ToConstructeur() : null
            };

            if (dico.GetString("datePoseOption") != null)
            {
                option.DatePoseOption = dico.GetDate("datePoseOption").DateTime;
            }

            if (dico.GetString("dateCreation") != null)
            {
                option.DateCreation = dico.GetDate("dateCreation").DateTime;
            }
            if (dico.GetString("dateModif") != null)
            {
                option.DateModif = dico.GetDate("dateModif").DateTime;
            }


            return(option);
        }
Пример #2
0
 public DictionaryStrategyTest()
 {
     _MutableDictionary = Substitute.For <IMutableDictionary <string, string> >();
     _Emulated          = new Dictionary <string, string>()
     {
         { "Key1", "Value1" },
         { "Key2", "Value2" },
     };
 }
 public MutableMiddleDictionaryTest()
 {
     _DictionarySwitcher = Substitute.For <IDictionaryStrategy>();
     DictionaryStrategyFactory <string> .Strategy = _DictionarySwitcher;
     _DictionaryTwoElements = Get(new Dictionary <string, string>()
     {
         { "Key0", "Value0" }, { "Key1", "Value1" }
     });
 }
Пример #4
0
        public IMutableDictionary <TKey, TValue> Add <TKey, TValue>(IMutableDictionary <TKey, TValue> current, TKey key, TValue value)
        {
            if (current.Count < _TransitionToDictionary)
            {
                current.Add(key, value);
                return(current);
            }

            return(GetNext(current).AddMutable(key, value));
        }
Пример #5
0
        public IMutableDictionary <TKey, TValue> Update <TKey, TValue>(IMutableDictionary <TKey, TValue> current, TKey key, TValue value)
        {
            if ((current.Count == _TransitionToDictionary) && (!current.ContainsKey(key)))
            {
                return(GetNext(current).AddMutable(key, value));
            }

            current[key] = value;
            return(current);
        }
Пример #6
0
        public IMutableDictionary <TKey, TValue> Remove <TKey, TValue>(IMutableDictionary <TKey, TValue> current, TKey key, out bool Result)
        {
            Result = current.Remove(key);

            if (current.Count == 1)
            {
                return(new MutableSingleDictionary <TKey, TValue>(current));
            }

            return(current);
        }
        public static Reservation ToReservation(this IMutableDictionary dico)
        {
            Reservation reservation = new Reservation()
            {
                Id = dico.GetString("id"),
                ProgrammeReserve   = dico.GetDictionary("programmeReserve").ToProgramme(),
                LotReserve         = dico.GetDictionary("lotReserve").ToLot(),
                PrixTerrainTtc     = dico.GetDouble("prixTerrainTtc"),
                MontantRemise      = dico.GetDouble("montantRemise"),
                MontantAcompte     = dico.GetDouble("montantAcompte"),
                LieuSignature      = dico.GetString("lieuSignature"),
                TiersVendeur       = dico.GetDictionary("tiersVendeur").ToVendeur(),
                FuturAcquereurId   = dico.GetString("futurAcquereurId"),
                SignatureEffective = dico.Contains("signatureEffective") ? dico.GetBoolean("signatureEffective") : false
            };

            if (dico.GetDictionary("tiersConstructeur") != null)
            {
                reservation.TiersConstructeur = dico.GetDictionary("tiersConstructeur").ToConstructeur();
            }

            if (dico.GetString("dateSignaturePv") != null)
            {
                reservation.DateSignaturePv = dico.GetDate("dateSignaturePv").DateTime;
            }

            if (dico.GetArray("financements") != null)
            {
                foreach (IMutableDictionary element in dico.GetArray("financements"))
                {
                    reservation.Financements.Add(element.ToFinancement());
                }
            }

            if (dico.GetString("dateCreation") != null)
            {
                reservation.DateCreation = dico.GetDate("dateCreation").DateTime;
            }
            if (dico.GetString("dateModif") != null)
            {
                reservation.DateModif = dico.GetDate("dateModif").DateTime;
            }
            if (dico.GetString("lastDateEdition") != null)
            {
                reservation.LastDateEdition = dico.GetDate("lastDateEdition").DateTime;
            }

            IFuturAcquereurDal futurAcquereurDal = App.Injector.GetInstance <IFuturAcquereurDal>();

            reservation.FuturAcquereur = futurAcquereurDal.Get(reservation.FuturAcquereurId);

            return(reservation);
        }
Пример #8
0
        public MutableSingleDictionaryTest()
        {
            _DictionarySwitcher = Substitute.For <IDictionaryStrategy>();
            DictionaryStrategyFactory <string> .Strategy = _DictionarySwitcher;

            _DictionaryNoElement = new MutableSingleDictionary <string, string>();

            var Dictionary = new Dictionary <string, string>()
            {
                { "Key0", "Value0" }
            };

            _DictionaryOneElement = new MutableSingleDictionary <string, string>(Dictionary);
        }
Пример #9
0
 public bool Remove(TKey key)
 {
     bool res;
     _Implementation = _Implementation.Remove(key, out res);
     return res;
 }
Пример #10
0
 public abstract IMutableDictionary <TKey, TValue> GetIntermediateCollection <TKey, TValue>(IMutableDictionary <TKey, TValue> current);
Пример #11
0
 public IMutableDictionary <TKey, TValue> CheckDictionaryRemoved <TKey, TValue>(IMutableDictionary <TKey, TValue> current)
 {
     return((current.Count == _TransitionToDictionary) ? GetIntermediateCollection(current) : current);
 }
Пример #12
0
 private void ChechHasTransitioned_Intermediate(IMutableDictionary <string, string> res)
 {
     ChechHasTransitioned <T>(res);
 }
Пример #13
0
 private void ChechHasTransitioned <TTest>(IMutableDictionary <string, string> res)
 {
     _MutableDictionary.Should().NotBeSameAs(res);
     res.Should().BeOfType <TTest>();
 }
Пример #14
0
 private void ChechHasTransitioned_Single(IMutableDictionary <string, string> res)
 {
     ChechHasTransitioned <MutableSingleDictionary <string, string> >(res);
 }
Пример #15
0
 private IMutableDictionary <TKey, TValue> GetNext <TKey, TValue>(IMutableDictionary <TKey, TValue> current)
 {
     return(new MutableDictionary <TKey, TValue>(current));
 }
Пример #16
0
 public HybridDictionary(int exceptedCapacity=0)
 {
     _Implementation = DictionaryStrategyFactory<TKey>.Strategy.GetEmpty<TKey, TValue>(exceptedCapacity);       
 }
Пример #17
0
 public void Add(TKey key, TValue value)
 {
     _Implementation = _Implementation.AddMutable(key, value);
 }
Пример #18
0
 public void Clear()
 {
     _Implementation = _Implementation.ClearMutable();
 }
 public override IMutableDictionary <TKey, TValue> GetIntermediateCollection <TKey, TValue>(IMutableDictionary <TKey, TValue> current)
 {
     return(new MutableSortedListDictionary <TKey, TValue>(current));
 }
Пример #20
0
 public TValue this[TKey key]
 {
     get { return _Implementation[key]; }
     set { _Implementation = _Implementation.Update(key, value); }
 }