public void SplitConfigurationsByPublication_MatchedPublicationIsIn()
 {
     using (var helper = new UndoableUnitOfWorkHelper(Cache.ActionHandlerAccessor, "doit", "undoit"))
     {
         var testPubItem = Cache.ServiceLocator.GetInstance <ICmPossibilityFactory>().Create();
         int enId        = Cache.WritingSystemFactory.GetWsFromStr("en");
         var testPubName = Cache.TsStrFactory.MakeString("TestPub", enId);
         Cache.LangProject.LexDbOA.PublicationTypesOA.PossibilitiesOS.Add(testPubItem);
         testPubItem.Name.set_String(enId, testPubName);
         var configWithTestPub = ConfigurationTemplate.Replace("</Publications>", "<Publication>TestPub</Publication></Publications>");
         using (var docView = new TestXhtmlDocView())
             using (var tempConfigFile = TempFile.WithFilename(Path.Combine(Path.GetTempPath(),
                                                                            "baz" + DictionaryConfigurationModel.FileExtension)))
             {
                 docView.SetConfigObjectName("Dictionary");
                 docView.SetMediator(m_mediator);
                 File.WriteAllText(tempConfigFile.Path, configWithTestPub);
                 IDictionary <string, string> configsWithPub;
                 IDictionary <string, string> configsWithoutPub;
                 var configurations = new Dictionary <string, string>();
                 configurations["AConfigPubtest"] = tempConfigFile.Path;
                 // SUT
                 docView.SplitConfigurationsByPublication(configurations,
                                                          "TestPub", out configsWithPub, out configsWithoutPub);
                 CollectionAssert.Contains(configsWithPub.Values, tempConfigFile.Path);
                 CollectionAssert.DoesNotContain(configsWithoutPub.Values, tempConfigFile.Path);
             }
     }
 }
Exemple #2
0
 public void SplitConfigurationsByPublication_ConfigWithAllPublicationIsIn()
 {
     using (var helper = new UndoableUnitOfWorkHelper(Cache.ActionHandlerAccessor, "doit", "undoit"))
     {
         var allPubsConfig = ConfigurationTemplateWithAllPublications;
         using (var docView = new TestXhtmlDocView())
             using (var tempConfigFile = TempFile.WithFilename(Path.Combine(Path.GetTempPath(),
                                                                            "AllPubsConf" + DictionaryConfigurationModel.FileExtension)))
             {
                 docView.SetConfigObjectName("Dictionary");
                 docView.SetMediator(m_mediator);
                 docView.SetPropertyTable(m_propertyTable);
                 File.WriteAllText(tempConfigFile.Path, allPubsConfig);
                 IDictionary <string, string> configsWithPub;
                 IDictionary <string, string> configsWithoutPub;
                 var configurations = new Dictionary <string, string>();
                 configurations["AConfigPubtest"] = tempConfigFile.Path;
                 // SUT
                 docView.SplitConfigurationsByPublication(configurations,
                                                          "TestPub", out configsWithPub, out configsWithoutPub);
                 CollectionAssert.Contains(configsWithPub.Values, tempConfigFile.Path);
                 CollectionAssert.DoesNotContain(configsWithoutPub.Values, tempConfigFile.Path);
             }
     }
 }