public void Constructors() { var widget = new GoogleAnalyticsWidget(); Assert.Null(widget.Account()); Assert.Null(widget.Domain()); }
public void ToHtmlString_Method() { Assert.Equal(string.Empty, new GoogleAnalyticsWidget().ToString()); Assert.Equal(string.Empty, new GoogleAnalyticsWidget().Account("account").ToString()); Assert.Equal(string.Empty, new GoogleAnalyticsWidget().Domain("domain").ToString()); var html = new GoogleAnalyticsWidget().Account("account").Domain("domain").ToString(); Assert.True(html.Contains("//www.google-analytics.com/analytics.js")); Assert.True(html.Contains(@"ga(""create"", ""account"", ""domain"");")); }
public void Domain_Method() { Assert.Throws<ArgumentNullException>(() => new GoogleAnalyticsWidget().Domain(null)); Assert.Throws<ArgumentException>(() => new GoogleAnalyticsWidget().Domain(string.Empty)); var widget = new GoogleAnalyticsWidget(); Assert.Null(widget.Domain()); Assert.True(ReferenceEquals(widget.Domain("domain"), widget)); Assert.Equal("domain", widget.Domain()); }
public void Account_Method() { Assert.Throws<ArgumentNullException>(() => new GoogleAnalyticsWidget().Account(null)); Assert.Throws<ArgumentException>(() => new GoogleAnalyticsWidget().Account(string.Empty)); var widget = new GoogleAnalyticsWidget(); Assert.Null(widget.Account()); Assert.True(ReferenceEquals(widget.Account("account"), widget)); Assert.Equal("account", widget.Account()); }
public void Domain_Method() { Assert.Throws <ArgumentNullException>(() => new GoogleAnalyticsWidget().Domain(null)); Assert.Throws <ArgumentException>(() => new GoogleAnalyticsWidget().Domain(string.Empty)); var widget = new GoogleAnalyticsWidget(); Assert.Null(widget.Domain()); Assert.True(ReferenceEquals(widget.Domain("domain"), widget)); Assert.Equal("domain", widget.Domain()); }
public void Account_Method() { Assert.Throws <ArgumentNullException>(() => new GoogleAnalyticsWidget().Account(null)); Assert.Throws <ArgumentException>(() => new GoogleAnalyticsWidget().Account(string.Empty)); var widget = new GoogleAnalyticsWidget(); Assert.Null(widget.Account()); Assert.True(ReferenceEquals(widget.Account("account"), widget)); Assert.Equal("account", widget.Account()); }