using NUnit.Framework;
using WatiN.Core;

namespace adMoto.Payments.Test.Web.UI
{
    [TestFixture]
    public class AuthenticationTests
    {
        [Test]
        [Category("UI")]
        public void Can_Not_Login_When_Using_InValid_Login_Information()
        {
            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
            ie.TextField(Find.ByName("numerFaktury")).TypeText("");
            ie.TextField(Find.ByName("nip")).TypeText("");
            ie.Button(Find.ById("loguj")).Click();
            Assert.IsTrue(ie.ContainsText("Logowanie nie powiodło się"));
            ie.ForceClose();
            ie.Close();
            ie.Dispose();
        }

        [Test]
        [Category("UI")]
        public void Can_Login_When_Using_Correct_Login_Information()
        {
            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
            ie.TextField(Find.ByName("numerFaktury")).TypeText("24/HOL/2009");
            ie.TextField(Find.ByName("nip")).TypeText("501379568");
            ie.Button(Find.ById("loguj")).Click();
            Assert.IsTrue(ie.ContainsText("została uregulowana"));
            ie.ForceClose();
            ie.Close();
            ie.Dispose();
        }
    }
}