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

using NUnit.Framework;

namespace adMoto.Payments.Test.Utils
{
    public class MerchantTests
    {
        [Test]
        [Category("Unit")]
        public void Currency_Is_Not_Valid()
        {
            //Arrange
            var payment = new PlatnosciEcard
                              {
                                  AMOUNT = 100,
                                  AUTODEPOSIT = true,
                                  ORDERDESCRIPTION = "abc/2009"
                              };
            var merchant = new Merchant { Payment = payment };

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

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

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

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

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

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

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

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