Skip to content

Commit

Permalink
recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbeletsky committed Jul 9, 2011
1 parent 2f9051b commit 4d41bda
Show file tree
Hide file tree
Showing 9 changed files with 1,226 additions and 1,227 deletions.
Binary file modified design/dashboard4/Content/Images/dashboard/cal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/dashboard4/Content/Images/dashboard/undo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/public2/Content/Images/dashboard/cal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified design/public2/Content/Images/dashboard/undo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
219 changes: 109 additions & 110 deletions src/Trackyt.Tests/Tests/Helpers/BlogPostsHelperTests.cs
Original file line number Diff line number Diff line change
@@ -1,110 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Trackyt.Core.DAL.DataModel;
using Web.Helpers;

namespace Trackyt.Core.Tests.Tests.Helpers
{
[TestFixture]
public class BlogPostsHelperTests
{
[Test]
public void GetPreviewPost_WithoutPreviewTag_ReturnPostAsOneParagraph()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("First. Second."));
}

[Test]
public void GetPreviewPost_WithPreviewTag_ReturnPreviewTextAsOneParagraph()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<post-preview><p>First from preview.</p><p>Second from preview.</p></post-preview><p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("First from preview. Second from preview. <a href=\"blog/posts/post-url\">Read more...</a>"));
}

[Test]
[ExpectedException(typeof(Exception), ExpectedMessage = "Bad post format: no </post-preview> closing tag.")]
public void GetPreviewPost_WithPreviewOpenedButNotClosed_ExceptionThrown()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<post-preview><p>First from preview.</p><p>Second from preview.</p><post-preview><p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
}

[Test]
public void GetPostPreview_WithPreviewTag_ReadMoreHrefAdded()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<post-preview><p>First from preview.</p><p>Second from preview.</p></post-preview><p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("First from preview. Second from preview. <a href=\"blog/posts/post-url\">Read more...</a>"));
}

[Test]
public void GetPost_WithoutPreviewTag_ReturnsUnmodifiedPost()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("<p>First.</p><p>Second.</p>"));
}

}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Trackyt.Core.DAL.DataModel;
using Web.Helpers;

namespace Trackyt.Core.Tests.Tests.Helpers
{
[TestFixture]
public class BlogPostsHelperTests
{
[Test]
public void GetPreviewPost_WithoutPreviewTag_ReturnPostAsOneParagraph()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("First. Second."));
}

[Test]
public void GetPreviewPost_WithPreviewTag_ReturnPreviewTextAsOneParagraph()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<post-preview><p>First from preview.</p><p>Second from preview.</p></post-preview><p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("First from preview. Second from preview. <a href=\"blog/posts/post-url\">Read more...</a>"));
}

[Test]
[ExpectedException(typeof(Exception), ExpectedMessage = "Bad post format: no </post-preview> closing tag.")]
public void GetPreviewPost_WithPreviewOpenedButNotClosed_ExceptionThrown()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<post-preview><p>First from preview.</p><p>Second from preview.</p><post-preview><p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
}

[Test]
public void GetPostPreview_WithPreviewTag_ReadMoreHrefAdded()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<post-preview><p>First from preview.</p><p>Second from preview.</p></post-preview><p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPreviewPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("First from preview. Second from preview. <a href=\"blog/posts/post-url\">Read more...</a>"));
}

[Test]
public void GetPost_WithoutPreviewTag_ReturnsUnmodifiedPost()
{
// arrange
var blogPost = new BlogPost
{
Url = "post-url",
Title = "post-title",
Body = @"<p>First.</p><p>Second.</p>",
CreatedBy = "alexanderb"
};

// act
var postBody = BlogPostsHelper.GetPostBody(blogPost);

// assert
Assert.That(postBody, Is.EqualTo("<p>First.</p><p>Second.</p>"));
}
}
}
Loading

0 comments on commit 4d41bda

Please sign in to comment.