public void Verify()
        {
            var serializer = new ConfigurationContainer().UseOptimizedNamespaces()
                             .EnableImplicitTyping(typeof(MainDTO), typeof(SubSubDTO))
                             .Type <SubSubDTO>()
                             .EnableReferences()
                             .Create()
                             .ForTesting();

            var instance = new MainDTO();

            serializer.Assert(instance, $@"<?xml version=""1.0"" encoding=""utf-8""?><Issue401Tests-MainDTO xmlns:exs=""https://extendedxmlserializer.github.io/v2""><Sub1 exs:identity=""1""><Id>{SubSubDTO.NullObject.Id}</Id></Sub1><Sub2 exs:reference=""1"" /><Sub3 exs:reference=""1"" /></Issue401Tests-MainDTO>");
        }
Пример #2
0
        /// <summary>
        /// Stores the current main weather data to the database
        /// </summary>
        /// <param name="main">Main.</param>
        public void SaveMain(Main main)
        {
            MainDTO mainDTO = main.ConvertToDTO();

            if (sqLiteConnection.Query <MainDTO>("SELECT * FROM Main").Count > 0)
            {
                var currentEntry = sqLiteConnection.Get <MainDTO>(1);
                mainDTO._id  = currentEntry._id; //swap ID to always ensure it will be record 1 being updated - only keeping one entry in db
                currentEntry = mainDTO;
                sqLiteConnection.Update(currentEntry);
            }
            else
            {
                sqLiteConnection.Insert(main);
            }
        }
        public void Verify()
        {
            var serializer = new ConfigurationContainer().UseAutoFormatting()
                             .UseOptimizedNamespaces()
                             .EnableImplicitTyping(typeof(MainDTO),
                                                   typeof(SubDTO), typeof(SubSubDTO))
                             .Type <SubSubDTO>()
                             .EnableReferences(definition => definition.Id)
                             .Create()
                             .ForTesting();

            var instance = new MainDTO();
            var cycled   = serializer.Cycle(instance);

            cycled.Sub1.SubSub1.Should().BeSameAs(cycled.Sub2.SubSub1);
            cycled.Sub1.SubSub1.Should().BeSameAs(cycled.Sub3.SubSub1);
        }
Пример #4
0
 private void LoadLocalSingleDay()
 {
     strLocalLocation = db_helper.GetSavedLocationText();
     localMain        = db_helper.GetSavedMainWeather();
     localWeather     = db_helper.GetSavedWeather();
 }