public void ReturnAmpAudioElementWithSourceStartingWithHttps_WhenTheAudioElementHasSourceAttribute() { // Arrange const string ExpectedResult = "https"; var audioElement = ElementFactory.CreateAudio(); audioElement.Source = "http://www.mysite.com"; ElementFactory.Document.Body.Append(audioElement); // Act var actualResult = new AudioSanitizer().Sanitize(ElementFactory.Document, audioElement); var ampElementSource = new Uri(actualResult.GetAttribute("src")); // Assert Assert.AreEqual(ExpectedResult, ampElementSource.Scheme); }
public void CopyAllChildrenFromTheOriginalAudioElementToTheAmpElement_Always() { // Arrange const int ExpectedResult = 2; var htmlElement = ElementFactory.CreateAudio(); var firstChild = ElementFactory.Create("input"); var secondChild = ElementFactory.Create("p"); htmlElement.Append(firstChild); htmlElement.Append(secondChild); ElementFactory.Document.Body.Append(htmlElement); // Act var actualResult = new AudioSanitizer().Sanitize(ElementFactory.Document, htmlElement); // Assert Assert.AreEqual(ExpectedResult, actualResult.Children.Length); }
public void CopyAllAttributesFromTheOriginalAudioElementToTheAmpElement_Always() { // Arrange var htmlElement = ElementFactory.CreateAudio(); htmlElement.Source = "https://www.example.com"; htmlElement.Id = "audioId"; htmlElement.ClassName = "someClassName"; ElementFactory.Document.Body.Append(htmlElement); // Act var actualResult = new AudioSanitizer().Sanitize(ElementFactory.Document, htmlElement); // Assert Assert.AreEqual("https://www.example.com", actualResult.GetAttribute("src")); Assert.AreEqual("audioId", actualResult.Id); Assert.AreEqual("someClassName", actualResult.ClassName); }
public void ThowArgumentNullException_WhenAmpElementArgumentIsNull() { // Assert Ensure.ArgumentExceptionIsThrown(() => new MediaSanitizerAccessor().SetMediaElementLayout(ElementFactory.CreateAudio(), null), "ampElement"); }