コード例 #1
0
 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");
 }
コード例 #2
0
 public void ConstructorWithNullTagNameThrows()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(
         delegate {
         new TagBuilder(null /* tagName */);
     }, "tagName");
 }
コード例 #3
0
        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");
        }
コード例 #4
0
 public void ConstructorWithEmptyTagNameThrows()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(
         delegate {
         new TagBuilder(String.Empty);
     }, "tagName");
 }
コード例 #5
0
ファイル: GamerCardTest.cs プロジェクト: yts111/ASP.NET-Mvc-3
 public void RenderThrowsWhenGamertagIsEmpty()
 {
     // Act & Assert
     ExceptionAssert.ThrowsArgNullOrEmpty(() => {
         GamerCard.GetHtml(string.Empty);
     }, "gamerTag");
 }
コード例 #6
0
        public void DataBindCrossTableThrowsWhenYFieldsIsEmpty()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            ExceptionAssert.ThrowsArgNullOrEmpty(() => {
                chart.DataBindCrossTable(new object[0], "GroupBy", xField: null, yFields: "");
            }, "yFields");
        }
コード例 #7
0
        public void SaveXmlThrowsWhenPathIsNull()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            ExceptionAssert.ThrowsArgNullOrEmpty(() => {
                chart.SaveXml(GetContext(), null);
            }, "path");
        }
コード例 #8
0
        public void SeriesThrowsWhenChartTypeIsNull()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            ExceptionAssert.ThrowsArgNullOrEmpty(() => {
                chart.AddSeries(chartType: null);
            }, "chartType");
        }
コード例 #9
0
        public void SaveThrowsWhenFormatIsNull()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            ExceptionAssert.ThrowsArgNullOrEmpty(() => {
                chart.Save(GetContext(), "chartPath", format: null);
            }, "format");
        }
コード例 #10
0
ファイル: ThemesTest.cs プロジェクト: yts111/ASP.NET-Mvc-3
        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");
        }
コード例 #11
0
        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");
        }
コード例 #12
0
        public void GetBytesThrowsWhenFormatIsEmpty()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            ExceptionAssert.ThrowsArgNullOrEmpty(() => {
                chart.GetBytes(format: String.Empty);
            }, "format");
        }
コード例 #13
0
        public void ListBoxThrowsWithNoName()
        {
            // Arrange
            HtmlHelper helper = new HtmlHelper(new ModelStateDictionary());

            // Act and assert
            ExceptionAssert.ThrowsArgNullOrEmpty(() => helper.ListBox(name: null, selectList: null), "name");
        }
コード例 #14
0
 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");
 }
コード例 #15
0
        public void SaveThrowsWhenPathIsEmpty()
        {
            var chart = new Chart(GetContext(), GetVirtualPathProvider(), 100, 100);

            ExceptionAssert.ThrowsArgNullOrEmpty(() => {
                chart.Save(GetContext(), path: String.Empty, format: "jpeg");
            }, "path");
        }
コード例 #16
0
        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");
        }
コード例 #17
0
        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");
        }
コード例 #18
0
        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");
        }
コード例 #19
0
        public void MergeAttributeWithNullKeyThrows()
        {
            // Arrange
            TagBuilder builder = new TagBuilder("SomeTag");

            // Act & Assert
            ExceptionAssert.ThrowsArgNullOrEmpty(
                delegate {
                builder.MergeAttribute(null, "value");
            }, "key");
        }
コード例 #20
0
        public void SetCultureThrowsIfValueIsNull()
        {
            // Arrange
            string value = null;
            var    webPageRenderingBase = new Mock <WebPageRenderingBase>()
            {
                CallBase = true
            }.Object;

            // Act and Assert
            ExceptionAssert.ThrowsArgNullOrEmpty(() => webPageRenderingBase.Culture = value, "value");
        }
コード例 #21
0
        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");
        }
コード例 #22
0
        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");
        }
コード例 #23
0
        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."
                );
        }
コード例 #24
0
ファイル: ThemesTest.cs プロジェクト: yts111/ASP.NET-Mvc-3
 public void CurrentThemeThrowsIfAssignedNullOrEmpty()
 {
     // Act and Assert
     ExceptionAssert.ThrowsArgNullOrEmpty(() => { Themes.CurrentTheme = null; }, "value");
     ExceptionAssert.ThrowsArgNullOrEmpty(() => { Themes.CurrentTheme = String.Empty; }, "value");
 }
コード例 #25
0
 public void RenderWithNullPageTitle_ThrowsException()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(
         () => LinkShare.GetHtml(null),
         "pageTitle");
 }
コード例 #26
0
        public void RegisterSpecialFile_ThrowsOnEmptyBaseTypeName()
        {
            TestHost host = new TestHost();

            ExceptionAssert.ThrowsArgNullOrEmpty(() => host.RegisterSpecialFile("file", String.Empty), "baseTypeName");
        }
コード例 #27
0
 public void ConstructorRequiresNonEmptyClassName()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(() => new VBRazorCodeGenerator(String.Empty, TestRootNamespaceName, TestPhysicalPath, CreateHost()), "className");
 }
コード例 #28
0
 public void RenderPageEmptyString()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(() => Utils.RenderWebPage(p => p.RenderPage("")), "path");
 }
コード例 #29
0
 public void RenderPageNull()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(() => Utils.RenderWebPage(p => p.RenderPage(null)), "path");
 }
コード例 #30
0
 public void RenderThrowsWhenEmailIsNull()
 {
     ExceptionAssert.ThrowsArgNullOrEmpty(() => {
         Gravatar.GetHtml(null);
     }, "email");
 }