1
0
mirror of https://github.com/ZetaKebab/MpcNET.git synced 2025-01-14 22:18:43 +00:00

Trigger travis to run tests. Sample test implemented.

This commit is contained in:
glucaci 2016-12-13 12:55:24 +01:00
parent d45aff33ee
commit 2880ce2e46
4 changed files with 62 additions and 49 deletions

View File

@ -4,6 +4,6 @@ sudo: required
mono: none mono: none
dotnet: 1.0.0-preview2-003131 dotnet: 1.0.0-preview2-003131
script: script:
- dotnet restore && dotnet build **/project.json - dotnet restore && dotnet build **/project.json && dotnet test LibMpcTest\project.json
notifications: notifications:
email:false email:false

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -11,6 +12,7 @@ namespace LibMpc
IMpdResponse<T> Response { get; } IMpdResponse<T> Response { get; }
} }
[DebuggerDisplay("Request: {Request.Command.Value} | Response Status: {Response.State.Status}")]
public class MpdMessage<T> : IMpdMessage<T> public class MpdMessage<T> : IMpdMessage<T>
{ {
private readonly Regex _linePattern = new Regex("^(?<key>[A-Za-z_]*):[ ]{0,1}(?<value>.*)$"); private readonly Regex _linePattern = new Regex("^(?<key>[A-Za-z_]*):[ ]{0,1}(?<value>.*)$");

View File

@ -1,9 +1,9 @@
using LibMpc; using LibMpc;
using System; using System;
using System.IO; using System.Linq;
using System.Net; using System.Net;
using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using Xunit; using Xunit;
using Xunit.Abstractions; using Xunit.Abstractions;
@ -30,6 +30,17 @@ namespace LibMpcTest
} }
} }
[Fact]
public async Task ListAllTest()
{
var response = await _mpc.SendAsync(new Commands.Reflection.TagTypes());
_output.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
Assert.True(response.Response.Body.Keys.Contains("tagtypes"));
Assert.True(response.Response.Body.Values.Any());
}
public void Dispose() public void Dispose()
{ {
_mpc?.DisconnectAsync().GetAwaiter().GetResult(); _mpc?.DisconnectAsync().GetAwaiter().GetResult();