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 AlbumResultTests
	{
		private IList<AlbumResult> _albumResults;

		[SetUp]
		public void SetUp()
		{
			var doc = new XmlDocument();
			doc.Load("AlbumResults-AbbeyRoad.xml");
			_albumResults = new AlbumResultPageParser().Parse(doc);
		}

		[Test]
		public void AlbumResultsTestSuite()
		{
			Assert.IsTrue(_albumResults.Count > 0);
			var resultInfo = _albumResults[0];
			Assert.AreEqual("The Beatles", resultInfo.ArtistName);
			Assert.AreEqual(1, resultInfo.ResultOrder);
			Assert.AreEqual("mw0000192938", resultInfo.AlbumId);
			Assert.AreEqual("Pop/Rock", resultInfo.Genre);
			Assert.AreEqual(1969, resultInfo.Year);
			Assert.AreEqual("Abbey Road", resultInfo.AlbumTitle);

			Assert.AreNotEqual("The Beatles", _albumResults[1].ArtistName);
		}

		[Test]
		public void AssertSerializableTest()
		{
			SerializationTester.AssertBinarySerializable(_albumResults);
		}
	}
}