using adMoto.Payments.Core;
using adMoto.Payments.Core.Data;

using NUnit.Framework;

namespace adMoto.Payments.Test.Web
{
    public class ValidationMerchantClassTests
    {
        [Test]
        [Category("Unit")]
        public void Currency_Is_Not_Valid()
        {
            //Arrange
            var p = new PlatnosciEcard(){
                AMOUNT = 100,
                AUTODEPOSIT = true,
                ORDERDESCRIPTION = "abc/2009"
            };
            var m = new Merchant() { Payment = p };
            
            //Act
            m.IsValid();
            var result = m.Error;

            //Assert
            System.Diagnostics.Debug.WriteLine("Error: " + result + " is not valid.");
            Assert.That(result, Is.EqualTo("currency"));
        }

        [Test]
        [Category("Unit")]
        public void Language_Is_Not_Valid()
        {
            //Arrange
            var p = new PlatnosciEcard(){
                AMOUNT = 100,
                AUTODEPOSIT = true,
                ORDERDESCRIPTION = "abc/2009",
                CURRENCY = "test",
                NAME = "test",
                SURNAME = "test"
            };
            var m = new Merchant(){ Payment = p };

            //Act
            m.IsValid();
            var result = m.Error;

            //Assert
            System.Diagnostics.Debug.WriteLine("Error: " + result + " is not valid.");
            Assert.That(result, Is.EqualTo("language"));
        }

        [Test]
        [Category("Unit")]
        public void Merchant_Data_Is_Valid()
        {
            //Arrange
            var p = new PlatnosciEcard(){
                AMOUNT = 100,
                AUTODEPOSIT = true,
                ORDERDESCRIPTION = "abc/2009",
                CURRENCY = "test",
                NAME = "test",
                SURNAME = "test",
                LANGUAGE = "test",
                ORDERNUMBER = 100
            };
            var m = new Merchant(){
                Payment = p,
                Id = "aaaa",
                Password = "aa",
                Hash = "22",
                LinkFail = "a",
                LinkOk = "a",
            };
            
            //Act
            m.IsValid();
            var result = m.Error;

            //Assert
            Assert.That(result, Is.EqualTo(null));
        }
    }
}
