예제 #1
0
        public void Set_Existing_Translation_Should_Not_Create_New_Entries()
        {
            lock (ConnectionString)
            {
                CleanDatabase();

                var key         = "Key";
                var translation = "Translation";
                var collection  = "some_collection";
                var category    = "some_category";
                var culture     = new CultureInfo("en-US");

                // This should create, since the database is clean
                _provider.Set(key, translation, collection, category, culture);

                var keys        = _provider.GetAllKeys();
                var collections = _provider.GetAllCollections();
                var languages   = _provider.GetAllLanguages();
                var categories  = _provider.GetAllCategories();
                var entries     = _provider.GetAllForCulture(culture);

                Assert.Single(keys);
                Assert.Single(collections);
                Assert.Single(languages);
                Assert.Single(categories);
                Assert.Single(entries);

                // This should update, not create
                _provider.Set(key, translation, collection, category, culture);

                keys        = _provider.GetAllKeys();
                collections = _provider.GetAllCollections();
                languages   = _provider.GetAllLanguages();
                categories  = _provider.GetAllCategories();
                entries     = _provider.GetAllForCulture(culture);

                Assert.Single(keys);
                Assert.Single(collections);
                Assert.Single(languages);
                Assert.Single(categories);
                Assert.Single(entries);

                CleanDatabase();
            }
        }