mirror of
				https://github.com/ZetaKebab/MpcNET.git
				synced 2025-11-04 04:19:49 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			79 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
namespace MpcNET.Test
 | 
						|
{
 | 
						|
    using System.Linq;
 | 
						|
    using System.Threading.Tasks;
 | 
						|
    using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
						|
    using MpcNET.Commands;
 | 
						|
 | 
						|
    public partial class LibMpcTest
 | 
						|
    {
 | 
						|
        [TestMethod]
 | 
						|
        public async Task CommandsTest()
 | 
						|
        {
 | 
						|
            var response = await Mpc.SendAsync(commands => commands.Reflection.Commands());
 | 
						|
 | 
						|
            TestOutput.WriteLine($"CommandsTest (commands: {response.Response.Content.Count()}) Result:");
 | 
						|
            TestOutput.WriteLine(response);
 | 
						|
 | 
						|
            // Different answer from MPD on Windows and on Linux, beacuse of Version.
 | 
						|
            // Check some of the commands.
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(command => command.Equals("listall")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(command => command.Equals("outputs")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(command => command.Equals("pause")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(command => command.Equals("play")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(command => command.Equals("setvol")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(command => command.Equals("stop")));
 | 
						|
        }
 | 
						|
 | 
						|
        [TestMethod]
 | 
						|
        public async Task TagTypesTest()
 | 
						|
        {
 | 
						|
            var response = await Mpc.SendAsync(commands => commands.Reflection.TagTypes());
 | 
						|
 | 
						|
            TestOutput.WriteLine("TagTypesTest Result:");
 | 
						|
            TestOutput.WriteLine(response);
 | 
						|
 | 
						|
            Assert.IsTrue(response.Response.Content.Count().Equals(17));
 | 
						|
        }
 | 
						|
 | 
						|
        [TestMethod]
 | 
						|
        public async Task UrlHandlersTest()
 | 
						|
        {
 | 
						|
            var response = await Mpc.SendAsync(commands => commands.Reflection.UrlHandlers());
 | 
						|
 | 
						|
            TestOutput.WriteLine($"UrlHandlersTest (handlers: {response.Response.Content.Count()}) Result:");
 | 
						|
            TestOutput.WriteLine(response);
 | 
						|
 | 
						|
            // Different answer from MPD on Windows and on Linux.
 | 
						|
            // Check some of the handlers.
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(handler => handler.Equals("http://")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(handler => handler.Equals("mms://")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(handler => handler.Equals("gopher://")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(handler => handler.Equals("rtp://")));
 | 
						|
        }
 | 
						|
 | 
						|
        [TestMethod]
 | 
						|
        public async Task DecodersTest()
 | 
						|
        {
 | 
						|
            var response = await Mpc.SendAsync(commands => commands.Reflection.Decoders());
 | 
						|
 | 
						|
            TestOutput.WriteLine($"DecodersTest (decoders: {response.Response.Content.Count()}) Result:");
 | 
						|
            TestOutput.WriteLine(response);
 | 
						|
 | 
						|
            // Different answer from MPD on Windows and on Linux.
 | 
						|
            // Check some of the decoders.
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Name.Equals("mad")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("mp3"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/mpeg"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Name.Equals("flac")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("flac"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/flac"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/x-flac"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Name.Equals("ffmpeg")));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("aac"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.Suffixes.Any(suffix => suffix.Equals("mpeg"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/aac"))));
 | 
						|
            Assert.IsTrue(response.Response.Content.Any(decoder => decoder.MediaTypes.Any(mediaType => mediaType.Equals("audio/mpeg"))));
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |