Exemplo n.º 1
0
        public void MetadataCanSaveList()
        {
            var input = new List <string> {
                "bob",
                "tom",
                null,
                "sam",
                "fry",
                "kevin",
                null,
                null,
                "carl",
            };
            var list = new StoredList("Input", input);

            var lines = new List <string>();

            list.AppendContents(lines);

            Assert.Equal(@"[[List]]
Name = '''Input'''
0 = [
   '''bob''',
   '''tom''',
]
3 = [
   '''sam''',
   '''fry''',
   '''kevin''',
]
8 = '''carl'''
".Split(Environment.NewLine).ToList(), lines);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Completes deserialization of the RollPost once the entire object graph has been deserialized.
 /// <para>This method should not be directly called.</para>
 /// </summary>
 /// <param name="sender"></param>
 public virtual void OnDeserialization(object sender)
 {
     _pristine    = PristineList.ToList();
     _stored      = StoredList.ToList();
     _current     = CurrentList.ToList();
     PristineList = _pristine;
     StoredList   = _stored;
     CurrentList  = _current;
 }
Exemplo n.º 3
0
        public void HashMatches_UpdateVersion_ListUpdates()
        {
            var someRealList = BaseModel.GetDefaultMetadatas().First().Lists.First();

            SetGameCode("BPRE0");

            var content  = new[] { "some", "content" };
            var metadata = new StoredMetadata(
                generalInfo: new StubMetadataInfo {
                VersionNumber = "0.0.1"
            },
                lists: new[] { new StoredList(someRealList.Name, content, StoredList.GenerateHash(content)) }
                );
            var model = new PokemonModel(Model.RawData, metadata, Singletons);

            model.TryGetList(someRealList.Name, out var list);
            Assert.Equal(someRealList.Contents, list.ToList());
        }
        /// <summary>
        /// Method that handles initialization of the observerable collection
        /// </summary>
        /// <param name="list">the list used to initialize the observerable collection</param>
        private void InitializeCollection(List <DriveReport> list)
        {
            _storedList.Clear();
            StoredList.Clear();

            foreach (var item in list)
            {
                var d = Convert.ToDateTime(item.Date);
                _storedList.Add(new StoredReportCellModel
                {
                    Date     = _datePre + d.ToString("d/M/yyyy"),
                    Distance = _distancePre + item.route.TotalDistance.ToString() + " km",
                    Purpose  = _purposePre + item.Purpose,
                    Taxe     = _taxePre + Definitions.User.Rates.FirstOrDefault(x => x.Id == item.RateId).Description,
                    report   = item,
                });
            }

            StoredList = _storedList;
        }