Example #1
0
        public void Can_delete_resource_entries()
        {
            var resources = context.Set <LocaleStringResource>();

            resources.Any().ShouldBeFalse();

            var entries  = GetDefaultResourceEntries();
            var migrator = new LocaleResourcesMigrator(context);

            migrator.Migrate(entries);

            var builder = new LocaleResourcesBuilder();

            builder.DeleteFor("de", "Res1", "Res2", "Res3");
            builder.DeleteFor("en", "Res1");
            context.DetachEntities <Language>();
            migrator.Migrate(builder.Build());

            resources.ToList().Count.ShouldEqual(2);

            builder.Reset();
            builder.DeleteFor("en", "Res2");
            context.DetachEntities <Language>();
            migrator.Migrate(builder.Build());

            resources.ToList().Count.ShouldEqual(1);
        }