Skip to content

Commit

Permalink
removed honeypotHelper tests. All logic has been moved to Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Web Advanced committed Oct 30, 2012
1 parent 71b9f9e commit cafee53
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 53 deletions.
35 changes: 0 additions & 35 deletions src/SimpleHoneypot.Tests/HoneypotHelperTests.cs

This file was deleted.

7 changes: 7 additions & 0 deletions src/SimpleHoneypot.Tests/HoneypotTests.cs
Expand Up @@ -4,6 +4,13 @@

namespace SimpleHoneypot.Tests {
public class HoneypotTests {
[Fact]
public void Ctor_ShouldSetCorrectDefaults() {
Assert.False(Honeypot.ManuallyHandleBots);
Assert.Equal(Honeypot.DefaultInputName, HoneypotData.DefaultFieldName);
Assert.Equal(Honeypot.CssClassName, HoneypotData.DefaultCssClassName);
}

[Fact]
public void SetCssClassName_ShouldThrowArgumentException_WhenPassedNullOrEmptyString() {
Assert.Throws<ArgumentException>(() => Honeypot.SetCssClassName(null));
Expand Down
24 changes: 13 additions & 11 deletions src/SimpleHoneypot/Core/Honeypot.cs
Expand Up @@ -24,8 +24,10 @@ namespace SimpleHoneypot.Core {
public static class Honeypot {
#region Constants and Fields

public static readonly HoneypotWorker Worker;
public const string HttpContextKey = "__hpIsBot";

public static readonly HoneypotWorker Worker;

#endregion

#region Constructors and Destructors
Expand Down Expand Up @@ -54,6 +56,14 @@ public static class Honeypot {

#region Public Methods and Operators

public static MvcHtmlString GetHtml(HtmlHelper helper) {
return Worker.GetHtml(helper, new HttpContextWrapper(HttpContext.Current));
}

public static bool IsBot(HttpContextBase context) {
return Worker.IsBot(context);
}

public static void SeDefaultInputName(string inputName) {
Check.Argument.IsNotNullOrEmpty(inputName, "inputName");
DefaultInputName = inputName;
Expand All @@ -64,16 +74,8 @@ public static class Honeypot {
CssClassName = cssClassName;
}

public static void SetManuallyHandleBots(bool b) {
ManuallyHandleBots = b;
}

public static MvcHtmlString GetHtml(HtmlHelper helper) {
return Worker.GetHtml(helper, new HttpContextWrapper(HttpContext.Current));
}

public static bool IsBot(HttpContextBase context) {
return Worker.IsBot(context);
public static void SetManuallyHandleBots(bool handleBots) {
ManuallyHandleBots = handleBots;
}

#endregion
Expand Down
7 changes: 0 additions & 7 deletions src/SimpleHoneypot/HtmlHelpers/HoneypotHelper.cs
Expand Up @@ -16,18 +16,11 @@
// --------------------------------------------------------------------------------------------------------------------

namespace SimpleHoneypot.HtmlHelpers {
using System;
using System.Web.Mvc;

using SimpleHoneypot.Core;

public static class HoneypotHelper {
#region Constants and Fields

private static readonly Random Random = new Random();

#endregion

#region Public Methods and Operators

public static MvcHtmlString HoneypotInput(this HtmlHelper helper) {
Expand Down

0 comments on commit cafee53

Please sign in to comment.