public void Can_delete_and_add_setting_entries()
        {
            var settings = context.Set<Setting>();
            settings.Any().ShouldBeFalse();

            var entries = GetDefaultSettingEntries();
            var migrator = new SettingsMigrator(context);
            migrator.Migrate(entries);

            var builder = new SettingsBuilder();
            builder.Delete("type1.setting1", "type2.setting1");
            migrator.Migrate(builder.Build());

            settings.ToList().Count.ShouldEqual(6);

            builder.Reset();
            builder.DeleteGroup("type1");
            migrator.Migrate(builder.Build());
            settings.ToList().Count.ShouldEqual(3);

            builder.Reset();
            builder.Add("type3.Setting1", true);
            builder.Add("type3.Setting2", 20);
            migrator.Migrate(builder.Build());
            var db = settings.ToList();
            db.Count.ShouldEqual(5);

            var st = settings.Where(x => x.Name == "type3.Setting2").FirstOrDefault();
            st.Value.ShouldEqual("20");

            settings.RemoveRange(db);
            context.SaveChanges();
        }
        public void Can_delete_and_add_setting_entries()
        {
            var settings = context.Set <Setting>();

            settings.Any().ShouldBeFalse();

            var entries  = GetDefaultSettingEntries();
            var migrator = new SettingsMigrator(context);

            migrator.Migrate(entries);

            var builder = new SettingsBuilder();

            builder.Delete("type1.setting1", "type2.setting1");
            migrator.Migrate(builder.Build());

            settings.ToList().Count.ShouldEqual(6);

            builder.Reset();
            builder.DeleteGroup("type1");
            migrator.Migrate(builder.Build());
            settings.ToList().Count.ShouldEqual(3);

            builder.Reset();
            builder.Add("type3.Setting1", true);
            builder.Add("type3.Setting2", 20);
            migrator.Migrate(builder.Build());
            var db = settings.ToList();

            db.Count.ShouldEqual(5);

            var st = settings.Where(x => x.Name == "type3.Setting2").FirstOrDefault();

            st.Value.ShouldEqual("20");
        }
        private IEnumerable <SettingEntry> GetDefaultSettingEntries()
        {
            var builder = new SettingsBuilder();

            builder.Add("Type1.Setting1", true);
            builder.Add("Type1.Setting2", 10);
            builder.Add("Type1.Setting3", "SomeString");
            builder.Add("Type1.Setting4", DateTime.Now);
            builder.Add("Type2.Setting1", false);
            builder.Add("Type2.Setting2", 5);
            builder.Add("Type2.Setting3", "SomeString2");
            builder.Add("Type2.Setting4", DateTime.UtcNow);

            return(builder.Build());
        }
        private IEnumerable<SettingEntry> GetDefaultSettingEntries()
        {
            var builder = new SettingsBuilder();
            builder.Add("Type1.Setting1", true);
            builder.Add("Type1.Setting2", 10);
            builder.Add("Type1.Setting3", "SomeString");
            builder.Add("Type1.Setting4", DateTime.Now);
            builder.Add("Type2.Setting1", false);
            builder.Add("Type2.Setting2", 5);
            builder.Add("Type2.Setting3", "SomeString2");
            builder.Add("Type2.Setting4", DateTime.UtcNow);

            return builder.Build();
        }