using System.Collections.Generic;
using System.Xml;
using MusicMetaTagger.Client.AllMusicGuide.RemoteDataAccess.Parser;
using MusicMetaTagger.Core.Model;
using NUnit.Framework;

namespace MusicMetaTagger.Client.AllMusicGuide.Tests.RemoteDataAccess.Parser
{
	[TestFixture]
	public class ArtistResultTests
	{
		private List<ArtistResult> _artistResults;

		[SetUp]
		public void SetUp()
		{
			var doc = new XmlDocument();
			doc.Load("ArtistResults-Spoon.xml");
			var artistParser = new ArtistResultPageParser();
			_artistResults = artistParser.Parse(doc);
		}

		[Test]
		public void ArtistResultsTestSuite()
		{
			Assert.That(_artistResults.Count, Is.GreaterThan(1));

			var artistResultInfo = _artistResults[0];
			Assert.AreEqual("Spoon", artistResultInfo.ArtistName);
			Assert.AreEqual(1, artistResultInfo.ResultOrder);
			Assert.AreEqual("Pop/Rock", artistResultInfo.Genre);
			Assert.AreEqual("1990s - 2010s", artistResultInfo.YearsActive);

			Assert.That(_artistResults[2].Genre, Is.Not.StringContaining("Pop/Rock"));

			SerializationTester.AssertBinarySerializable(_artistResults);
		}
	}
}