From dfeee740375c4c44c3e0e6d5d0772fad727aac5f Mon Sep 17 00:00:00 2001 From: Sam Rule Date: Tue, 10 Jan 2017 15:24:30 +0000 Subject: [PATCH] Hopefully should fix the live issues? --- Disbott/Resources/Constants.cs | 19 ++++++------------- .../MessageCount/MessageCountOperations.cs | 3 +++ DisbottUnitTests/Quotes/QuotesOperations.cs | 6 ++++++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Disbott/Resources/Constants.cs b/Disbott/Resources/Constants.cs index 2301f9f..5336b6d 100644 --- a/Disbott/Resources/Constants.cs +++ b/Disbott/Resources/Constants.cs @@ -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"; @@ -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 - + } } diff --git a/DisbottUnitTests/MessageCount/MessageCountOperations.cs b/DisbottUnitTests/MessageCount/MessageCountOperations.cs index 6f0524d..55c73fa 100644 --- a/DisbottUnitTests/MessageCount/MessageCountOperations.cs +++ b/DisbottUnitTests/MessageCount/MessageCountOperations.cs @@ -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] @@ -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] @@ -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); } } } diff --git a/DisbottUnitTests/Quotes/QuotesOperations.cs b/DisbottUnitTests/Quotes/QuotesOperations.cs index aea1127..6e44bc0 100644 --- a/DisbottUnitTests/Quotes/QuotesOperations.cs +++ b/DisbottUnitTests/Quotes/QuotesOperations.cs @@ -2,6 +2,8 @@ using Disbott.Controllers; using NUnit.Framework; using NUnit.Framework.Internal.Commands; +using System.IO; +using Disbott; namespace DisbottUnitTests { @@ -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); } /// @@ -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); } /// @@ -42,6 +46,7 @@ public void Get_Quote_Fail() { var quoteTuple = QuotesController.GetQuoteMethod("tomo"); Assert.IsNull(quoteTuple.Item2); + File.Delete(Constants.quotePath); } /// @@ -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); } } }