RemoveSingleForm() public method

public RemoveSingleForm ( string key, string lang ) : void
key string
lang string
return void
Example #1
0
 public void RemoveSingleForm_HasForm_Removed()
 {
     var htmlDom = new HtmlDom();
     var data = new BookData(htmlDom, new CollectionSettings(), null);
     data.Set("1","one","en");
     var data2 = new BookData(htmlDom, new CollectionSettings(), null);
     data2.RemoveSingleForm("1","en");
     Assert.IsNull(data2.GetVariableOrNull("1", "en"));
 }
Example #2
0
 public void RemoveDataDivVariableForOneLanguage_WasLastForm_WholeElementRemoved()
 {
     var htmlDom = new HtmlDom();
     var data = new BookData(htmlDom, new CollectionSettings(), null);
     data.Set("1","one","en");
     var roundTripData = new BookData(htmlDom, new CollectionSettings(), null);
     roundTripData.RemoveSingleForm("1", "en");
     Assert.IsNull(roundTripData.GetVariableOrNull("1", "en"));
 }
Example #3
0
 public void RemoveDataDivVariableForOneLanguage_WasTwoForms_OtherRemains()
 {
     var htmlDom = new HtmlDom();
     var data = new BookData(htmlDom, new CollectionSettings(), null);
     data.Set("1", "one", "en");
     data.Set("1", "uno", "es");
     var roundTripData = new BookData(htmlDom, new CollectionSettings(), null);
     roundTripData.RemoveSingleForm("1", "en");
     Assert.IsNull(roundTripData.GetVariableOrNull("1", "en"));
     Assert.AreEqual("uno",roundTripData.GetVariableOrNull("1","es"));
 }
Example #4
0
 public void RemoveDataDivVariableForOneLanguage_DoesNotHaveForm_OK()
 {
     var htmlDom = new HtmlDom();
     var data = new BookData(htmlDom, new CollectionSettings(), null);
     data.RemoveSingleForm("1", "en");
     Assert.AreEqual(null, data.GetVariableOrNull("1", "en"));
     AssertThatXmlIn.Dom(htmlDom.RawDom).HasSpecifiedNumberOfMatchesForXpath("//div[@lang='en']", 0);
     var roundTripData = new BookData(htmlDom, new CollectionSettings(), null);
     Assert.IsNull(roundTripData.GetVariableOrNull("1", "en"));
 }