// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Web;
using Moq;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
namespace Microsoft.Web.Helpers.Test
{
public class VideoTest
{
private VirtualPathUtilityWrapper _pathUtility = new VirtualPathUtilityWrapper();
[Fact]
public void FlashCannotOverrideHtmlAttributes()
{
Assert.ThrowsArgument(() => { Video.Flash(GetContext(), _pathUtility, "http://foo.bar.com/foo.swf", htmlAttributes: new { cLASSid = "CanNotOverride" }); }, "htmlAttributes", "Property \"cLASSid\" cannot be set through this argument.");
}
[Fact]
public void FlashDefaults()
{
string html = Video.Flash(GetContext(), _pathUtility, "http://foo.bar.com/foo.swf").ToString().Replace("\r\n", "");
Assert.True(html.StartsWith(
""));
}
[Fact]
public void FlashThrowsWhenPathIsEmpty()
{
Assert.ThrowsArgumentNullOrEmptyString(() => { Video.Flash(GetContext(), _pathUtility, String.Empty); }, "path");
}
[Fact]
public void FlashThrowsWhenPathIsNull()
{
Assert.ThrowsArgumentNullOrEmptyString(() => { Video.Flash(GetContext(), _pathUtility, null); }, "path");
}
[Fact]
public void FlashWithExposedOptions()
{
string html = Video.Flash(GetContext(), _pathUtility, "http://foo.bar.com/foo.swf", width: "100px", height: "100px",
play: false, loop: false, menu: false, backgroundColor: "#000", quality: "Q", scale: "S", windowMode: "WM",
baseUrl: "http://foo.bar.com/", version: "1.0.0.0", htmlAttributes: new { id = "fl" }, embedName: "efl").ToString().Replace("\r\n", "");
Assert.True(html.StartsWith(
"