diff --git a/src/Mewdeko.Coordinator/Mewdeko.Coordinator.csproj b/src/Mewdeko.Coordinator/Mewdeko.Coordinator.csproj
index 20c11ce62..bc63122cc 100644
--- a/src/Mewdeko.Coordinator/Mewdeko.Coordinator.csproj
+++ b/src/Mewdeko.Coordinator/Mewdeko.Coordinator.csproj
@@ -10,19 +10,17 @@
-
-
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
+
+
+
+
+
diff --git a/src/Mewdeko.Database/Mewdeko.Database.csproj b/src/Mewdeko.Database/Mewdeko.Database.csproj
index 925ee0323..21db58579 100644
--- a/src/Mewdeko.Database/Mewdeko.Database.csproj
+++ b/src/Mewdeko.Database/Mewdeko.Database.csproj
@@ -10,23 +10,23 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
+
+
+
+
+
diff --git a/src/Mewdeko.Tests/BotStringsTests.cs b/src/Mewdeko.Tests/BotStringsTests.cs
index dedc066c5..249c52bf2 100644
--- a/src/Mewdeko.Tests/BotStringsTests.cs
+++ b/src/Mewdeko.Tests/BotStringsTests.cs
@@ -38,7 +38,7 @@ where cmdStrings is null
TestContext.Out.WriteLine($"{commandName} doesn't exist in commands.en-US.yml");
}
- Assert.IsTrue(isSuccess);
+ Assert.That(isSuccess);
}
private static IEnumerable GetCommandMethodNames()
@@ -69,7 +69,7 @@ public void AllCommandMethodsHaveNames()
isSuccess = false;
}
- Assert.IsTrue(isSuccess);
+ Assert.That(isSuccess);
}
[Test]
@@ -88,6 +88,6 @@ public void NoObsoleteAliases()
isSuccess = false;
}
- Assert.IsTrue(isSuccess);
+ Assert.That(isSuccess);
}
}
\ No newline at end of file
diff --git a/src/Mewdeko.Tests/GroupGreetTests.cs b/src/Mewdeko.Tests/GroupGreetTests.cs
deleted file mode 100644
index 61a75fb9d..000000000
--- a/src/Mewdeko.Tests/GroupGreetTests.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System.Linq;
-using System.Threading.Tasks;
-using Mewdeko.Services.Common;
-using NUnit.Framework;
-
-namespace Mewdeko.Tests;
-
-public class GroupGreetTests
-{
- private GreetGrouper grouper;
-
- [SetUp]
- public void Setup()
- => grouper = new GreetGrouper();
-
- [Test]
- public void CreateTest()
- {
- var created = grouper.CreateOrAdd(0, 5);
-
- Assert.True(created);
- }
-
- [Test]
- public void CreateClearTest()
- {
- grouper.CreateOrAdd(0, 5);
- grouper.ClearGroup(0, 5, out var items);
-
- Assert.AreEqual(0, items.Count());
- }
-
- [Test]
- public void NotCreatedTest()
- {
- grouper.CreateOrAdd(0, 5);
- var created = grouper.CreateOrAdd(0, 4);
-
- Assert.False(created);
- }
-
- [Test]
- public void ClearAddedTest()
- {
- grouper.CreateOrAdd(0, 5);
- grouper.CreateOrAdd(0, 4);
- grouper.ClearGroup(0, 5, out var items);
-
- var list = items.ToList();
-
- Assert.AreEqual(1, list.Count, $"Count was {list.Count}");
- Assert.AreEqual(4, list[0]);
- }
-
- [Test]
- public async Task ClearManyTest()
- {
- grouper.CreateOrAdd(0, 5);
-
- // add 15 items
- await Task.WhenAll(Enumerable.Range(10, 15)
- .Select(x => Task.Run(() => grouper.CreateOrAdd(0, x)))).ConfigureAwait(false);
-
- // get 5 at most
- grouper.ClearGroup(0, 5, out var items);
- var list = items.ToList();
- Assert.AreEqual(5, list.Count, $"Count was {list.Count}");
-
- // try to get 15, but there should be 10 left
- grouper.ClearGroup(0, 15, out items);
- list = items.ToList();
- Assert.AreEqual(10, list.Count, $"Count was {list.Count}");
- }
-}
\ No newline at end of file
diff --git a/src/Mewdeko.Tests/IndexedCollectionTests.cs b/src/Mewdeko.Tests/IndexedCollectionTests.cs
deleted file mode 100644
index d26f9bba0..000000000
--- a/src/Mewdeko.Tests/IndexedCollectionTests.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Mewdeko.Database.Common;
-using Mewdeko.Database.Models;
-using NUnit.Framework;
-
-namespace Mewdeko.Tests;
-
-public class IndexedCollectionTests
-{
- [Test]
- public void AddTest()
- {
- var collection = GetCollectionSample(Enumerable.Empty());
-
- // Add the items
- for (var counter = 0; counter < 10; counter++)
- collection.Add(new ShopEntry());
-
- // Evaluate the items are ordered
- CheckIndices(collection);
- }
-
- [Test]
- public void RemoveTest()
- {
- var collection = GetCollectionSample();
-
- collection.Remove(collection[1]);
- collection.Remove(collection[1]);
-
- // Evaluate the indices are ordered
- CheckIndices(collection);
- Assert.AreEqual(8, collection.Count);
- }
-
- [Test]
- public void RemoveAtTest()
- {
- var collection = GetCollectionSample();
-
- // Remove items 5 and 7
- collection.RemoveAt(5);
- collection.RemoveAt(6);
-
- // Evaluate if the items got removed
- foreach (var item in collection)
- Assert.IsFalse(item.Id == 5 || item.Id == 7, $"Item at index {item.Index} was not removed");
-
- CheckIndices(collection);
-
- // RemoveAt out of range
- Assert.Throws(() => collection.RemoveAt(999), $"No exception thrown when removing from index 999 in a collection of size {collection.Count}.");
- Assert.Throws(() => collection.RemoveAt(-3), "No exception thrown when removing from negative index -3.");
- }
-
- [Test]
- public void ClearTest()
- {
- var collection = GetCollectionSample();
- collection.Clear();
-
- Assert.IsTrue(collection.Count == 0, "Collection has not been cleared.");
- // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
- _ = Assert.Throws(() => collection.Contains(collection[0]), "Collection has not been cleared.");
- }
-
- [Test]
- public void CopyToTest()
- {
- var collection = GetCollectionSample();
- var fullCopy = new ShopEntry[10];
-
- collection.CopyTo(fullCopy, 0);
-
- // Evaluate copy
- for (var index = 0; index < fullCopy.Length; index++)
- Assert.AreEqual(index, fullCopy[index].Index);
-
- Assert.Throws(() => collection.CopyTo(new ShopEntry[10], 4));
- Assert.Throws(() => collection.CopyTo(new ShopEntry[6], 0));
- }
-
- [Test]
- public void IndexOfTest()
- {
- var collection = GetCollectionSample();
-
- Assert.AreEqual(4, collection.IndexOf(collection[4]));
- Assert.AreEqual(0, collection.IndexOf(collection[0]));
- Assert.AreEqual(7, collection.IndexOf(collection[7]));
- Assert.AreEqual(9, collection.IndexOf(collection[9]));
- }
-
- [Test]
- public void InsertTest()
- {
- var collection = GetCollectionSample();
-
- // Insert items at indices 5 and 7
- collection.Insert(5, new ShopEntry
- {
- Id = 555
- });
- collection.Insert(7, new ShopEntry
- {
- Id = 777
- });
-
- Assert.AreEqual(12, collection.Count);
- Assert.AreEqual(555, collection[5].Id);
- Assert.AreEqual(777, collection[7].Id);
-
- CheckIndices(collection);
-
- // Insert out of range
- Assert.Throws(() => collection.Insert(999, new ShopEntry
- {
- Id = 999
- }), $"No exception thrown when inserting at index 999 in a collection of size {collection.Count}.");
- Assert.Throws(() => collection.Insert(-3, new ShopEntry
- {
- Id = -3
- }), "No exception thrown when inserting at negative index -3.");
- }
-
- [Test]
- public void ContainsTest()
- {
- var subCol = new[]
- {
- new ShopEntry
- {
- Id = 111
- },
- new ShopEntry
- {
- Id = 222
- },
- new ShopEntry
- {
- Id = 333
- }
- };
-
- var collection = GetCollectionSample(
- Enumerable.Range(0, 10)
- .Select(x => new ShopEntry
- {
- Id = x
- })
- .Concat(subCol)
- );
-
- collection.Remove(subCol[1]);
- CheckIndices(collection);
-
- Assert.IsTrue(collection.Contains(subCol[0]));
- Assert.IsFalse(collection.Contains(subCol[1]));
- Assert.IsTrue(collection.Contains(subCol[2]));
- }
-
- [Test]
- public void EnumeratorTest()
- {
- var collection = GetCollectionSample();
- using var enumerator = collection.GetEnumerator();
-
- foreach (var item in collection)
- {
- enumerator.MoveNext();
- Assert.AreEqual(item, enumerator.Current);
- }
- }
-
- [Test]
- public void IndexTest()
- {
- var collection = GetCollectionSample();
-
- collection[4] = new ShopEntry
- {
- Id = 444
- };
- collection[7] = new ShopEntry
- {
- Id = 777
- };
- CheckIndices(collection);
-
- Assert.AreEqual(444, collection[4].Id);
- Assert.AreEqual(777, collection[7].Id);
- }
-
- ///
- /// Checks whether all indices of the items are properly ordered.
- ///
- /// An indexed, reference type.
- /// The indexed collection to be checked.
- private static void CheckIndices(IndexedCollection collection) where T : class, IIndexed
- {
- for (var index = 0; index < collection.Count; index++)
- Assert.AreEqual(index, collection[index].Index);
- }
-
- ///
- /// Gets an from the specified or a collection with 10 shop entries if none is provided.
- ///
- /// An indexed, database entity type.
- /// A sample collection to be added as an indexed collection.
- /// An indexed collection of .
- private static IndexedCollection GetCollectionSample(IEnumerable sample = default) where T : DbEntity, IIndexed, new()
- => new(sample ?? Enumerable.Range(0, 10).Select(x => new T
- {
- Id = x
- }));
-}
\ No newline at end of file
diff --git a/src/Mewdeko.Tests/Mewdeko.Tests.csproj b/src/Mewdeko.Tests/Mewdeko.Tests.csproj
index cf66946f0..983ac36c7 100644
--- a/src/Mewdeko.Tests/Mewdeko.Tests.csproj
+++ b/src/Mewdeko.Tests/Mewdeko.Tests.csproj
@@ -8,12 +8,10 @@
-
-
-
-
-
-
+
+
+
+
diff --git a/src/Mewdeko.Tests/PubSubTests.cs b/src/Mewdeko.Tests/PubSubTests.cs
deleted file mode 100644
index cc3ba649c..000000000
--- a/src/Mewdeko.Tests/PubSubTests.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using System.Threading.Tasks;
-using Mewdeko.Common.PubSub;
-using NUnit.Framework;
-using NUnit.Framework.Internal;
-
-namespace Mewdeko.Tests;
-
-public class PubSubTests
-{
- [Test]
- public async Task Test_EventPubSub_PubSub()
- {
- TypedKey key = "test_key";
- var expected = new Randomizer().Next();
- var pubsub = new EventPubSub();
- await pubsub.Sub(key, data =>
- {
- Assert.AreEqual(expected, data);
- Assert.Pass();
- return default;
- }).ConfigureAwait(false);
- await pubsub.Pub(key, expected).ConfigureAwait(false);
- Assert.Fail("Event not registered");
- }
-
- [Test]
- public async Task Test_EventPubSub_MeaninglessUnsub()
- {
- TypedKey key = "test_key";
- var expected = new Randomizer().Next();
- var pubsub = new EventPubSub();
- await pubsub.Sub(key, data =>
- {
- Assert.AreEqual(expected, data);
- Assert.Pass();
- return default;
- }).ConfigureAwait(false);
- await pubsub.Unsub(key, _ => default).ConfigureAwait(false);
- await pubsub.Pub(key, expected).ConfigureAwait(false);
- Assert.Fail("Event not registered");
- }
-
- [Test]
- public async Task Test_EventPubSub_MeaninglessUnsubThatLooksTheSame()
- {
- TypedKey key = "test_key";
- var expected = new Randomizer().Next();
- var pubsub = new EventPubSub();
- await pubsub.Sub(key, data =>
- {
- Assert.AreEqual(expected, data);
- Assert.Pass();
- return default;
- }).ConfigureAwait(false);
- await pubsub.Unsub(key, data =>
- {
- Assert.AreEqual(expected, data);
- Assert.Pass();
- return default;
- }).ConfigureAwait(false);
- await pubsub.Pub(key, expected).ConfigureAwait(false);
- Assert.Fail("Event not registered");
- }
-
- [Test]
- public async Task Test_EventPubSub_MeaningfullUnsub()
- {
- TypedKey key = "test_key";
- var pubsub = new EventPubSub();
-
- ValueTask Action(int data)
- {
- Assert.Fail("Event is raised when it shouldn't be");
- return default;
- }
-
- await pubsub.Sub(key, Action).ConfigureAwait(false);
- await pubsub.Unsub(key, Action).ConfigureAwait(false);
- await pubsub.Pub(key, 0).ConfigureAwait(false);
- Assert.Pass();
- }
-
- [Test]
- public async Task Test_EventPubSub_ObjectData()
- {
- TypedKey key = "test_key";
- var pubsub = new EventPubSub();
-
- var localData = new byte[1];
-
- ValueTask Action(byte[] data)
- {
- Assert.AreEqual(localData, data);
- Assert.Pass();
- return default;
- }
-
- await pubsub.Sub(key, Action).ConfigureAwait(false);
- await pubsub.Pub(key, localData).ConfigureAwait(false);
-
- Assert.Fail("Event not raised");
- }
-
- [Test]
- public async Task Test_EventPubSub_MultiSubUnsub()
- {
- TypedKey