Skip to content

Commit

Permalink
Hopefully should fix the live issues?
Browse files Browse the repository at this point in the history
  • Loading branch information
80cmdude committed Jan 10, 2017
1 parent 09c2efe commit dfeee74
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Disbott/Resources/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Disbott
{
public static class Constants
{
#if DEBUG
#if DEBUG
public static string quotePath = Path.GetDirectoryName(Path.GetDirectoryName
(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))).Remove(0, 6) + "\\bin\\Debug\\quotestest.db";

Expand All @@ -22,18 +22,11 @@ public static class Constants
public static string MessageCountPath = Path.GetDirectoryName(Path.GetDirectoryName
(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))).Remove(0, 6) + "\\bin\\Debug\\MessageCounttest.db";
#else
public static string quotePath = Path.GetDirectoryName(Path.GetDirectoryName
(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))).Remove(0, 6) + "\\bin\\Release\\quotes.db";

public static string remindMePath = Path.GetDirectoryName(Path.GetDirectoryName
(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))).Remove(0, 6) + "\\bin\\Release\\remindme.db";

public static string pollPath = Path.GetDirectoryName(Path.GetDirectoryName
(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))).Remove(0, 6) + "\\bin\\Release\\poll.db";

public static string MessageCountPath = Path.GetDirectoryName(Path.GetDirectoryName
(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase))).Remove(0, 6) + "\\bin\\Release\\MessageCount.db";
public static string quotePath = "Quote.db";
public static string remindMePath = "remindMe.db";
public static string pollPath = "poll.db";
public static string MessageCountPath = "MessageCount.db";
#endif

}
}
3 changes: 3 additions & 0 deletions DisbottUnitTests/MessageCount/MessageCountOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public void Can_Log_Message()
bool success = MessageCount.MessageRecord(1);

Assert.That(success, Is.EqualTo(true));
File.Delete(Constants.MessageCountPath);
}

[Test]
Expand All @@ -30,6 +31,7 @@ public void Can_Get_MessageCount_Check()
MessageCount.MessageRecord(1);
string count = MessageCount.GetMessages(1);
Assert.AreEqual($"<@!1> has posted 1 messages", count);
File.Delete(Constants.MessageCountPath);
}

[Test]
Expand All @@ -40,6 +42,7 @@ public void Can_Log_Second_Message()
bool success = MessageCount.MessageRecord(1);

Assert.That(success, Is.EqualTo(true));
File.Delete(Constants.MessageCountPath);
}
}
}
6 changes: 6 additions & 0 deletions DisbottUnitTests/Quotes/QuotesOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using Disbott.Controllers;
using NUnit.Framework;
using NUnit.Framework.Internal.Commands;
using System.IO;
using Disbott;

namespace DisbottUnitTests
{
Expand All @@ -19,6 +21,7 @@ public void Add_Quote_Check()
{
var result = QuotesController.AddQuoteMethod("Dan", "I'm in the army");
Assert.IsTrue(result);
File.Delete(Constants.quotePath);
}

/// <summary>
Expand All @@ -32,6 +35,7 @@ public void Get_Quote_Check()

Assert.That(quoteTuple.Item1, Is.EqualTo("disbott"));
Assert.That(quoteTuple.Item2, Is.EqualTo("this is a test"));
File.Delete(Constants.quotePath);
}

/// <summary>
Expand All @@ -42,6 +46,7 @@ public void Get_Quote_Fail()
{
var quoteTuple = QuotesController.GetQuoteMethod("tomo");
Assert.IsNull(quoteTuple.Item2);
File.Delete(Constants.quotePath);
}

/// <summary>
Expand All @@ -52,6 +57,7 @@ public void Delete_Quote_Check()
{
var result = QuotesController.DeleteQuoteMethod("I'm in the army");
Assert.IsTrue(result);
File.Delete(Constants.quotePath);
}
}
}

0 comments on commit dfeee74

Please sign in to comment.