public void ConstructorRequiresNonNullOrEmptyVirtualPath() { ExceptionAssert.ThrowsArgNullOrEmpty(() => new WebPageRazorHost(null), "virtualPath"); ExceptionAssert.ThrowsArgNullOrEmpty(() => new WebPageRazorHost(String.Empty), "virtualPath"); ExceptionAssert.ThrowsArgNullOrEmpty(() => new WebPageRazorHost(null, "foo"), "virtualPath"); ExceptionAssert.ThrowsArgNullOrEmpty(() => new WebPageRazorHost(String.Empty, "foo"), "virtualPath"); }
public void ConstructorWithNullTagNameThrows() { ExceptionAssert.ThrowsArgNullOrEmpty( delegate { new TagBuilder(null /* tagName */); }, "tagName"); }
public void RegisterSpecialFile_ThrowsOnEmptyFileName() { TestHost host = new TestHost(); ExceptionAssert.ThrowsArgNullOrEmpty(() => host.RegisterSpecialFile(String.Empty, typeof(string)), "fileName"); ExceptionAssert.ThrowsArgNullOrEmpty(() => host.RegisterSpecialFile(String.Empty, "string"), "fileName"); }
public void ConstructorWithEmptyTagNameThrows() { ExceptionAssert.ThrowsArgNullOrEmpty( delegate { new TagBuilder(String.Empty); }, "tagName"); }
public void RenderThrowsWhenGamertagIsEmpty() { // Act & Assert ExceptionAssert.ThrowsArgNullOrEmpty(() => { GamerCard.GetHtml(string.Empty); }, "gamerTag"); }
public void DataBindCrossTableThrowsWhenYFieldsIsEmpty() { var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100); ExceptionAssert.ThrowsArgNullOrEmpty(() => { chart.DataBindCrossTable(new object[0], "GroupBy", xField: null, yFields: ""); }, "yFields"); }
public void SaveXmlThrowsWhenPathIsNull() { var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100); ExceptionAssert.ThrowsArgNullOrEmpty(() => { chart.SaveXml(GetContext(), null); }, "path"); }
public void SeriesThrowsWhenChartTypeIsNull() { var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100); ExceptionAssert.ThrowsArgNullOrEmpty(() => { chart.AddSeries(chartType: null); }, "chartType"); }
public void SaveThrowsWhenFormatIsNull() { var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100); ExceptionAssert.ThrowsArgNullOrEmpty(() => { chart.Save(GetContext(), "chartPath", format: null); }, "format"); }
public void Initialize_WithBadParams_Throws() { ExceptionAssert.ThrowsArgNullOrEmpty(() => Themes.Initialize(null, "foo"), "themeDirectory"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Themes.Initialize("", "foo"), "themeDirectory"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Themes.Initialize("~/folder", null), "defaultTheme"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Themes.Initialize("~/folder", ""), "defaultTheme"); }
public void FindPackagesByIdThrowsIfIdIsNullOrEmpty(string id) { // Arrange var repository = new LocalPackageRepository(Mock.Of <IPackagePathResolver>(), Mock.Of <IFileSystem>()); // Act and Assert ExceptionAssert.ThrowsArgNullOrEmpty(() => repository.FindPackagesById(id), "packageId"); }
public void GetBytesThrowsWhenFormatIsEmpty() { var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100); ExceptionAssert.ThrowsArgNullOrEmpty(() => { chart.GetBytes(format: String.Empty); }, "format"); }
public void ListBoxThrowsWithNoName() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act and assert ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.ListBox(name: null, selectList: null), "name"); }
public void CreateHostFromConfigRequiresNonEmptyVirtualPath() { ExceptionAssert.ThrowsArgNullOrEmpty(() => WebRazorHostFactory.CreateHostFromConfig(virtualPath: String.Empty, physicalPath: "foo"), "virtualPath"); ExceptionAssert.ThrowsArgNullOrEmpty(() => WebRazorHostFactory.CreateHostFromConfig(config: new RazorWebSectionGroup(), virtualPath: String.Empty, physicalPath: "foo"), "virtualPath"); }
public void SaveThrowsWhenPathIsEmpty() { var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100); ExceptionAssert.ThrowsArgNullOrEmpty(() => { chart.Save(GetContext(), path: String.Empty, format: "jpeg"); }, "path"); }
public void PasswordWithNullNameThrows() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act & Assert ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.Password(null), "name"); ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.Password(String.Empty), "name"); }
public void RadioButtonWithEmptyNameThrows() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act and assert ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.RadioButton(null, null), "name"); ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.RadioButton(String.Empty, null), "name"); }
public void CheckboxWithEmptyNameThrows() { // Arrange HtmlHelper helper = new HtmlHelper(new ModelStateDictionary()); // Act and assert ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.CheckBox(null), "name"); ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.CheckBox(String.Empty), "name"); }
public void MergeAttributeWithNullKeyThrows() { // Arrange TagBuilder builder = new TagBuilder("SomeTag"); // Act & Assert ExceptionAssert.ThrowsArgNullOrEmpty( delegate { builder.MergeAttribute(null, "value"); }, "key"); }
public void SetCultureThrowsIfValueIsNull() { // Arrange string value = null; var webPageRenderingBase = new Mock <WebPageRenderingBase>() { CallBase = true }.Object; // Act and Assert ExceptionAssert.ThrowsArgNullOrEmpty(() => webPageRenderingBase.Culture = value, "value"); }
public void SearchWithInvalidArgs_ThrowsArgumentException() { ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search(null), "searchQuery"); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Search("any term", width: -1)); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Search("any term", height: -1)); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Search("any term", searchInterval: 0)); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search("any term", backgroundShellColor: null), "backgroundShellColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search("any term", shellColor: null), "shellColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search("any term", tweetsBackgroundColor: null), "tweetsBackgroundColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search("any term", tweetsColor: null), "tweetsColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search("any term", tweetsLinksColor: null), "tweetsLinksColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Search("any term", behavior: null), "behavior"); }
public void ProfileWithInvalidArgs_ThrowsArgumentException() { ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile(null), "twitterUserName"); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Profile("anyName", width: -1)); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Profile("anyName", height: -1)); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Profile("anyName", searchInterval: 0)); ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => Twitter.Profile("anyName", numberOfTweets: 0)); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile("anyName", backgroundShellColor: null), "backgroundShellColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile("anyName", shellColor: null), "shellColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile("anyName", tweetsBackgroundColor: null), "tweetsBackgroundColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile("anyName", tweetsColor: null), "tweetsColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile("anyName", tweetsLinksColor: null), "tweetsLinksColor"); ExceptionAssert.ThrowsArgNullOrEmpty(() => Twitter.Profile("anyName", behavior: null), "behavior"); }
public void GuardClauses() { // Arrange AntiForgeryDataSerializer serializer = new AntiForgeryDataSerializer(); // Act & assert ExceptionAssert.ThrowsArgNull( () => serializer.Serialize(null), "token" ); ExceptionAssert.ThrowsArgNullOrEmpty( () => serializer.Deserialize(null), "serializedToken" ); ExceptionAssert.ThrowsArgNullOrEmpty( () => serializer.Deserialize(String.Empty), "serializedToken" ); ExceptionAssert.Throws <HttpAntiForgeryException>( () => serializer.Deserialize("Corrupted Base-64 Value"), "A required anti-forgery token was not supplied or was invalid." ); }
public void CurrentThemeThrowsIfAssignedNullOrEmpty() { // Act and Assert ExceptionAssert.ThrowsArgNullOrEmpty(() => { Themes.CurrentTheme = null; }, "value"); ExceptionAssert.ThrowsArgNullOrEmpty(() => { Themes.CurrentTheme = String.Empty; }, "value"); }
public void RenderWithNullPageTitle_ThrowsException() { ExceptionAssert.ThrowsArgNullOrEmpty( () => LinkShare.GetHtml(null), "pageTitle"); }
public void RegisterSpecialFile_ThrowsOnEmptyBaseTypeName() { TestHost host = new TestHost(); ExceptionAssert.ThrowsArgNullOrEmpty(() => host.RegisterSpecialFile("file", String.Empty), "baseTypeName"); }
public void ConstructorRequiresNonEmptyClassName() { ExceptionAssert.ThrowsArgNullOrEmpty(() => new VBRazorCodeGenerator(String.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost()), "className"); }
public void RenderPageEmptyString() { ExceptionAssert.ThrowsArgNullOrEmpty(() => Utils.RenderWebPage(p => p.RenderPage("")), "path"); }
public void RenderPageNull() { ExceptionAssert.ThrowsArgNullOrEmpty(() => Utils.RenderWebPage(p => p.RenderPage(null)), "path"); }
public void RenderThrowsWhenEmailIsNull() { ExceptionAssert.ThrowsArgNullOrEmpty(() => { Gravatar.GetHtml(null); }, "email"); }