diff --git a/src/IF.Lastfm.Core.Tests/Api/LastMethodsNamesTests.cs b/src/IF.Lastfm.Core.Tests/Api/LastMethodsNamesTests.cs new file mode 100644 index 0000000..98b3786 --- /dev/null +++ b/src/IF.Lastfm.Core.Tests/Api/LastMethodsNamesTests.cs @@ -0,0 +1,27 @@ +using IF.Lastfm.Core.Api; +using IF.Lastfm.Core.Api.Commands; +using IF.Lastfm.Core.Api.Helpers; +using NUnit.Framework; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace IF.Lastfm.Core.Tests.Api +{ + + public class LastMethodsNamesTests + { + [Test] + public void EnsureEachCommandHasAnApiMethodNameAttribute() + { + var commandBaseType = typeof(LastAsyncCommandBase); + var allCommands = commandBaseType.Assembly.DefinedTypes + .Where(t => t != commandBaseType && commandBaseType.IsAssignableFrom(t)) + .Where(t => t.IsClass && !t.IsAbstract); + + var commandsWithoutAttribute = allCommands.Where(x => !x.GetCustomAttributes().Any()); + + Assert.IsFalse(commandsWithoutAttribute.Any(), "Warning, all commands should have anApiMethodNameAttribute."); + } + } +} \ No newline at end of file diff --git a/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj b/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj index c487bb1..f9ef721 100644 --- a/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj +++ b/src/IF.Lastfm.Core.Tests/IF.Lastfm.Core.Tests.csproj @@ -99,6 +99,7 @@ +