Skip to content
Browse files

Added tests for FormattingExtensions.

  • Loading branch information...
1 parent 02cf2e9 commit bf77e41f70d620453fbb3e61fcda53894b30d1e8 Kristoffer Ahl committed Nov 29, 2011
View
1 source/Glimpse.Test.Core/Glimpse.Test.Core.csproj
@@ -53,6 +53,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Plugin\Assist\AssistExtensionsTest.cs" />
+ <Compile Include="Plugin\Assist\FormattingExtensionsTest.cs" />
<Compile Include="Plugin\Assist\GlimpseColumnTest.cs" />
<Compile Include="Plugin\Assist\GlimpseRowTest.cs" />
<Compile Include="Plugin\Assist\GlimpseSectionTest.cs" />
View
67 source/Glimpse.Test.Core/Plugin/Assist/FormattingExtensionsTest.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Linq;
+using Glimpse.Core.Plugin.Assist;
+using NUnit.Framework;
+
+namespace Glimpse.Test.Core.Plugin.Assist
+{
+ [TestFixture]
+ public class FormattingExtensionsTest
+ {
+ [Test]
+ public void GlimpseRow_Bold_AppliesBoldToLastColumn()
+ {
+ var row = Row.Bold();
+
+ Assert.AreEqual(row.Columns.Last().Data, "*Text*");
+ }
+
+ [Test]
+ public void GlimpseRow_Underline_AppliesUnderlineToLastColumn()
+ {
+ var row = Row.Underline();
+
+ Assert.AreEqual(row.Columns.Last().Data, "_Text_");
+ }
+
+ [Test]
+ public void GlimpseRow_RowOperation_IsInvalidForRowsWithoutColumns()
+ {
+ var row = new GlimpseRow();
+
+ Assert.Throws<InvalidOperationException>(() => row.Quiet());
+ }
+
+ [Test]
+ public void GlimpseRow_Quiet_AddsColumnWithQuiet()
+ {
+ var row = Row.Quiet();
+
+ Assert.AreEqual(row.Columns.Last().Data, "quiet");
+ }
+
+ [Test]
+ public void GlimpseRow_Selected_AddsColumnWithSelected()
+ {
+ var row = Row.Selected();
+
+ Assert.AreEqual(row.Columns.Last().Data, "selected");
+ }
+
+ [Test]
+ public void GlimpseRow_Warn_AddsColumnWithWarn()
+ {
+ var row = Row.Warn();
+
+ Assert.AreEqual(row.Columns.Last().Data, "warn");
+ }
+
+ private GlimpseRow Row { get; set; }
+
+ [SetUp]
+ public void Setup()
+ {
+ Row = new GlimpseRow().Column("Text");
+ }
+ }
+}

0 comments on commit bf77e41

Please sign in to comment.
Something went wrong with that request. Please try again.