public void TestRemove() { SetUp(); var site = Path.Combine("Website1", "web.config"); var expected = "expected_remove1.site.config"; var document = XDocument.Load(site); document.Save(expected); var item = new MimeMapItem(null); item.FileExtension = ".xl1"; item.MimeType = "text/test"; _feature.AddItem(item); Assert.Equal(".xl1", _feature.SelectedItem.FileExtension); Assert.Equal(375, _feature.Items.Count); _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Equal(374, _feature.Items.Count); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(expected, site); }
public void TestAdd() { SetUp(); var site = Path.Combine("Website1", "web.config"); var expected = "expected_edit.site.config"; var document = XDocument.Load(site); var node = document.Root.XPathSelectElement("/configuration/system.webServer"); var content = new XElement("staticContent"); node?.Add(content); var add = new XElement("mimeMap"); add.SetAttributeValue("fileExtension", ".pp1"); add.SetAttributeValue("mimeType", "text/test"); content.Add(add); document.Save(expected); var item = new MimeMapItem(null); item.FileExtension = ".pp1"; item.MimeType = "text/test"; _feature.AddItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".pp1", _feature.SelectedItem.FileExtension); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(expected, site); }
public async void TestAdd() { await this.SetUp(); var item = new MimeMapItem(null); item.FileExtension = ".pp1"; item.MimeType = "text/test"; _feature.AddItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".pp1", _feature.SelectedItem.FileExtension); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(Path.Combine("MimeMap", "expected_add.site.config"), Path.Combine("Website1", "web.config")); }
public async void TestAdd() { await this.SetUp(); const string Expected = @"expected_add.config"; const string ExpectedMono = @"expected_add.mono.config"; var item = new MimeMapItem(null); item.FileExtension = ".tx1"; item.MimeType = "text/test"; _feature.AddItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".tx1", _feature.SelectedItem.FileExtension); Assert.Equal(375, _feature.Items.Count); XmlAssert.Equal( Helper.IsRunningOnMono() ? Path.Combine("MimeMap", ExpectedMono) : Path.Combine("MimeMap", Expected), Current); }
public void TestAdd() { SetUp(); const string Expected = @"expected_add.config"; var document = XDocument.Load(Current); var node = document.Root.XPathSelectElement("/configuration/system.webServer/staticContent"); var element = new XElement("mimeMap"); element.SetAttributeValue("fileExtension", ".tx1"); element.SetAttributeValue("mimeType", "text/test"); node?.Add(element); document.Save(Expected); var item = new MimeMapItem(null); item.FileExtension = ".tx1"; item.MimeType = "text/test"; _feature.AddItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".tx1", _feature.SelectedItem.FileExtension); Assert.Equal(375, _feature.Items.Count); XmlAssert.Equal(Expected, Current); }