public void SaveTest() { var manager = new HybridResourceManager("KGySoft.CoreLibraries.Resources.TestCompiledResource", GetType().Assembly, resXBaseName); // empty manager: save all is false even if forcing Assert.IsFalse(manager.IsModified); Assert.IsFalse(manager.SaveAllResources(true)); // non-empty but unmodified manager: saving on forcing manager.GetResourceSet(inv, true, false); Assert.IsFalse(manager.IsModified); Assert.IsFalse(manager.SaveAllResources(false)); //Assert.IsTrue(manager.SaveAllResources(true)); // - was OK in MSTest as it supports deployment manager.ReleaseAllResources(); // adding a new value to a non-existing resource // it will be dirty and can be saved without forcing, then it is not dirty any more manager.SetObject("new value en-GB", 42, enGB); Assert.IsTrue(manager.IsModified); Assert.IsTrue(manager.SaveAllResources(false)); Assert.IsFalse(manager.IsModified); // adding a new value: it will be dirty and saves without forcing, then it is not dirty any more manager.SetObject("new value", 42, enUS); Assert.IsTrue(manager.IsModified); Assert.IsNotNull(manager.GetResourceSet(enUS, false, false)); Assert.IsFalse(manager.SaveResourceSet(inv)); //Assert.IsTrue(manager.SaveResourceSet(enUS)); // - was OK in MSTest as it supports deployment manager.GetExpandoResourceSet(enUS, ResourceSetRetrieval.GetIfAlreadyLoaded).Save(new MemoryStream()); // in NUnit saving into memory so output folder will not change Assert.IsFalse(manager.IsModified); // in compiled only mode save returns always false manager.SetObject("new value inv", -42, inv); Assert.IsTrue(manager.IsModified); manager.Source = ResourceManagerSources.CompiledOnly; Assert.IsFalse(manager.IsModified); Assert.IsFalse(manager.SaveResourceSet(inv)); Assert.IsFalse(manager.SaveAllResources(true)); manager.Source = ResourceManagerSources.ResXOnly; Assert.IsTrue(manager.IsModified); //Assert.IsTrue(manager.SaveResourceSet(inv)); // - was OK in MSTest as it supports deployment manager.GetExpandoResourceSet(inv, ResourceSetRetrieval.GetIfAlreadyLoaded).Save(new MemoryStream()); // in NUnit saving into memory so output folder will not change Assert.IsFalse(manager.IsModified); // removing added new files Clean(manager, enGB); }