Index: /trunk/eCard/eCardMVC/Platnosci/Models/eCardData.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci/Models/eCardData.cs (revision 959)
+++ /trunk/eCard/eCardMVC/Platnosci/Models/eCardData.cs (revision 960)
@@ -1,8 +1,6 @@
 ﻿using System;
-using System.Web;
 using System.Net;
 using System.IO;
 using System.Linq;
-using System.Web.Mvc;
 using System.Configuration;
 using Platnosci.Core.Linq;
@@ -16,5 +14,5 @@
         private readonly FunkcjePlatnosci _funkcjePlatnosci;
         private IRepository<PlatnosciEcard> _repPayment;
-        
+
         public eCardData(IRepository<PlatnosciEcard> repPayment)
         {
@@ -25,7 +23,7 @@
         public String GetUrl(Merchant merchant)
         {
-            if (merchant == null) 
-                throw new ArgumentNullException("parametr merchant is null in GetUrl method");
-            
+            if (merchant == null)
+                throw new ArgumentNullException("merchant");
+
             var dane = ConfigurationManager.AppSettings["eCard.Url"] + "?ORDERDESCRIPTION=" + merchant.Payment.ORDERDESCRIPTION;
             dane += "&AMOUNT=" + merchant.Payment.AMOUNT + "&CURRENCY=" + merchant.Payment.CURRENCY;
@@ -42,11 +40,14 @@
         {
             var merchant = new Merchant();
-           
+
             var waluta = _funkcjePlatnosci.SetAmount(invoice);
             var newPayment = _funkcjePlatnosci.CreateAndAddNewPyment(invoice, waluta, payer, sessionId);
 
             merchant.SystemKsiegowy = invoice.SystemKsiegowyId.ToString();
-            if (ConfigurationManager.AppSettings["wersja"] == "TEST")
-                merchant.SystemKsiegowy = "2";
+
+#if DEBUG
+            //TODO: find better method to set SystemKsiegowy when testing or developing
+            merchant.SystemKsiegowy = "2";
+#endif
 
             merchant.Payment = newPayment;
@@ -59,5 +60,5 @@
             var linkFail = ConfigurationManager.AppSettings["Strona"];
             linkFail += "/" + lang + ConfigurationManager.AppSettings["LinkFail"];
-            linkFail += "/" + newPayment.IDFaktury + "?o=" + orderek; 
+            linkFail += "/" + newPayment.IDFaktury + "?o=" + orderek;
 
             var linkOk = ConfigurationManager.AppSettings["Strona"];
@@ -68,5 +69,5 @@
             merchant.LinkFail = linkFail;
 
-            if (merchant != null) merchant.IsValid();
+            merchant.IsValid();
 
             return merchant;
@@ -88,9 +89,9 @@
         {
             if (merchant == null)
-                throw new ArgumentNullException("parametr merchant is null in SetHash method");
+                throw new ArgumentNullException("merchant");
 
             var platnosc = _repPayment.Find(i => i.ORDERDESCRIPTION == merchant.Payment.ORDERDESCRIPTION && i.IDFaktury == merchant.Payment.IDFaktury && i.Data == merchant.Payment.Data).SingleOrDefault();
 
-            if (platnosc == null)            
+            if (platnosc == null)
                 merchant.Hash = HASH_ERROR_INFO;
             else
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Platnosci.Tests.csproj
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Platnosci.Tests.csproj (revision 959)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Platnosci.Tests.csproj (revision 960)
@@ -93,7 +93,7 @@
     <Compile Include="Web\StatusTest.cs" />
     <Compile Include="Web\TestMethods.cs" />
-    <Compile Include="Web\UIAccountTest.cs" />
-    <Compile Include="Web\UIFieldTest.cs" />
-    <Compile Include="Web\UIPlatnosciTests.cs" />
+    <Compile Include="Web\UI\AuthenticationTests.cs" />
+    <Compile Include="Web\UI\ValidationTests.cs" />
+    <Compile Include="Web\UI\MerchantTests.cs" />
   </ItemGroup>
   <ItemGroup>
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Web/eCardDataTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/eCardDataTests.cs (revision 959)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Web/eCardDataTests.cs (revision 960)
@@ -1,10 +1,5 @@
 ﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using NUnit.Framework;
 using Platnosci.Models;
-using Platnosci.Core;
-using Platnosci.Core.Interface;
 using Platnosci.Core.Linq;
 
@@ -15,7 +10,9 @@
     { 
         private readonly Function _function = new Function();
+
         [Test]
         [Category("Unit")]
-        public void Set_Hash_Return_zlyHash(){
+        public void SetHash_Returns_zlyHash_When_Passing_Invalid_Merchant()
+        {
             var repPayment = new Repository<PlatnosciEcard>(new FakeDataContext());
             var platnosc = _function.CreateNewPayment(123, true, DateTime.Now, 1);
@@ -32,7 +29,8 @@
             Assert.That(result, Is.EqualTo(Merchant.BAD_HASH));
         }
+        
         [Test]
         [Category("Unit")]
-        public void Set_Hash_Return_Payment_Is_Null()
+        public void SetHash_Returns_PaymentErrorInfo_When_Passing_Invalid_Payment()
         {
             var repPayment = new Repository<PlatnosciEcard>(new FakeDataContext());
@@ -58,5 +56,5 @@
         [Test]
         [Category("Unit")]
-        public void Set_Hash_Return_Correct_Hash()
+        public void SetHash_Returns_Correct_Hash_When_Passing_Valid_Data()
         {
             var repPayment = new Repository<PlatnosciEcard>(new FakeDataContext());
@@ -78,7 +76,8 @@
             Assert.That(result.Length, Is.EqualTo(48) );
         }
+
         [Test]
         [Category("Unit")]
-        public void Set_Hash_Amount_Zero_Return_zlyHash()
+        public void SetHash_Returns_BAD_HASH_When_Invoice_Amount_Is_Zero()
         {
             var repPayment = new Repository<PlatnosciEcard>(new FakeDataContext());
@@ -100,7 +99,8 @@
             Assert.That(result, Is.EqualTo(Merchant.BAD_HASH));
         }
+
         [Test]
         [Category("Unit")]
-        public void Set_Hash_Bad_Password_Return_zlyHash()
+        public void SetHash_Returns_BAD_HASH_When_Password_Is_Wrong()
         {
             var repPayment = new Repository<PlatnosciEcard>(new FakeDataContext());
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Web/FunkcjePlatnosciTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/FunkcjePlatnosciTests.cs (revision 957)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Web/FunkcjePlatnosciTests.cs (revision 960)
@@ -1,6 +1,3 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+﻿using System.Linq;
 using NUnit.Framework;
 using Platnosci.Models;
@@ -19,5 +16,5 @@
         [Test, Sequential]
         [Category("Unit")]
-        public void GetCurrency_Returns_PLN_When_Passing_Null(
+        public void GetCurrency_Returns_Correct_Currency(
             [Values(null, "", "eur", "usd", "gbp", "GBP")] string input,
             [Values(FunkcjePlatnosci.PLN, FunkcjePlatnosci.PLN, FunkcjePlatnosci.EUR, FunkcjePlatnosci.USD, FunkcjePlatnosci.GBP, FunkcjePlatnosci.GBP)] string output
@@ -28,7 +25,8 @@
             Assert.That(result, Is.EqualTo(output));
         }
+
         [Test]
         [Category("Unit")]
-        public void TestMethodCreateAndAddNewPaymentOk()
+        public void CreateAndAddNewPayment_Creates_PlatnosciEcard()
         {
             var idFaktury = 123;
@@ -38,8 +36,8 @@
             var payer = _function.CreatePayer(idFaktury, "test", "test");
             var waluta = new Waluta { Amount = 200, Currency = FunkcjePlatnosci.PLN };
-            var result = funkcjePlatnosci.CreateAndAddNewPyment(invoice, waluta, payer, "sessionId");
+            funkcjePlatnosci.CreateAndAddNewPyment(invoice, waluta, payer, "sessionId");
 
             var payment = repPayment.Find(p => p.IDFaktury == 123).SingleOrDefault();
-            Assert.That(payment.IDFaktury, Is.EqualTo(idFaktury));
+            Assert.That(payment.AMOUNT, Is.EqualTo(200));
         }
     }
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Web/MerchantControllerTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/MerchantControllerTests.cs (revision 957)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Web/MerchantControllerTests.cs (revision 960)
@@ -17,6 +17,7 @@
         [Test]
         [Category("Unit")]
-        public void IncorrectUserIdentity_ReturnErrorView()
-        {
+        public void Merchant_Action_Returns_Error_When_Passing_Incorrect_User_Identity()
+        {
+            //Arrange
             IRepository<vPlatnosciEcard> repVPayment = new Repository<vPlatnosciEcard>(new FakeDataContext());
             vPlatnosciEcard platnosc = _function.CreateInvoice(123, "nip1", "", 0, 0);
@@ -28,10 +29,13 @@
             controller.ControllerContext = _function.CreateControllerContext("nip2");
 
+            //Act
             var result = controller.Merchant(payer, "pl") as ViewResult;
             var error = (ErrorViewData)result.ViewData.Model;
 
+            //Assert
             Assert.That(error.Error, Is.EqualTo("weryfikacja"));
             Assert.That(result.ViewName, Is.EqualTo("Error1"));
         }
+
         [Test]
         [Category("Unit")]
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/ValidationTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/ValidationTests.cs (revision 960)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/ValidationTests.cs (revision 960)
@@ -0,0 +1,66 @@
+﻿using NUnit.Framework;
+using WatiN.Core;
+
+namespace Platnosci.Tests.Web.UI
+{
+    [TestFixture]
+    public class ValidationTests
+    {
+        [Test]
+        [Category("UI")]
+        public void Validates_When_Firstname_Is_Too_Long()
+        {
+            const string test = "test";
+            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
+            ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
+            ie.TextField(Find.ByName("nip")).TypeText("9730727417");
+            ie.Button(Find.ById("loguj")).Click();
+
+            ie.TextField(Find.ByName("Payer.FirstName")).TypeText("12345678901234567890123456");
+            ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
+            ie.Button(Find.ById("place")).Click();
+            Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
+            ie.ForceClose();
+            ie.Close();
+            ie.Dispose();
+        }
+
+        [Test]
+        [Category("UI")]
+        public void Validates_When_Surname_Is_Too_Long()
+        {
+            const string test = "test";
+            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
+            ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
+            ie.TextField(Find.ByName("nip")).TypeText("9730727417");
+            ie.Button(Find.ById("loguj")).Click();
+
+            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
+            ie.TextField(Find.ByName("Payer.LastName")).TypeText("1234567890123456789012345678901");
+            ie.Button(Find.ById("place")).Click();
+            Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
+            ie.ForceClose();
+            ie.Close();
+            ie.Dispose();
+        }
+
+        [Test]
+        [Category("UI")]
+        public void Validates_When_LastName_Is_Empty()
+        {
+            const string test = "test";
+            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
+            ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009");
+            ie.TextField(Find.ByName("nip")).TypeText("854956281");
+            ie.Button(Find.ById("loguj")).Click();
+
+            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
+            ie.TextField(Find.ByName("Payer.LastName")).TypeText("");
+            ie.Button(Find.ById("place")).Click();
+            Assert.IsTrue(ie.ContainsText("Proszę podać"));
+            ie.ForceClose();
+            ie.Close();
+            ie.Dispose();
+        }
+    }
+}
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/AuthenticationTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/AuthenticationTests.cs (revision 960)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/AuthenticationTests.cs (revision 960)
@@ -0,0 +1,37 @@
+﻿using NUnit.Framework;
+using WatiN.Core;
+
+namespace Platnosci.Tests.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();
+        }
+    }
+}
Index: /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/MerchantTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/MerchantTests.cs (revision 960)
+++ /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UI/MerchantTests.cs (revision 960)
@@ -0,0 +1,51 @@
+﻿using NUnit.Framework;
+using WatiN.Core;
+
+namespace Platnosci.Tests.Web.UI
+{
+    [TestFixture]
+    public class MerchantTests
+    {
+        [Test]
+        [Category("UI")]
+        public void Redirects_To_Ecard_When_All_Details_Are_Correct()
+        {
+            const string test = "test";
+            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
+            ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009");
+            ie.TextField(Find.ByName("nip")).TypeText("854956281");
+            ie.Button(Find.ById("loguj")).Click();
+
+            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
+            ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
+            ie.Button(Find.ById("place")).Click();
+            Assert.IsTrue(ie.ContainsText("Imię i nazwisko:" + test + " " + test));
+            Assert.IsTrue(ie.Url.Contains("https://pay.ecard.pl/"));
+            ie.ForceClose();
+            ie.Close();
+            ie.Dispose();
+        }
+
+        [Test]
+        [Category("UI")]
+        public void Returns_ZlyHash_When_Invoice_Amount_Is_Zero()
+        {
+            // wartosc faktury 1/SLJ/2009 jest 0 (zero)
+            // wowczas eCard powinien zwrocic zlyHash - stala informujaca, ze cos jest nie tak...
+
+            const string test = "test";
+            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
+            ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
+            ie.TextField(Find.ByName("nip")).TypeText("9730727417");
+            ie.Button(Find.ById("loguj")).Click();
+
+            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
+            ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
+            ie.Button(Find.ById("place")).Click();
+            Assert.IsTrue(ie.ContainsText("Wystąpił nieoczekiwany błąd"));
+            ie.ForceClose();
+            ie.Close();
+            ie.Dispose();
+        }
+    }
+}
Index: /unk/eCard/eCardMVC/Platnosci.Tests/Web/UIPlatnosciTests.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UIPlatnosciTests.cs (revision 958)
+++  (revision )
@@ -1,66 +1,0 @@
-﻿using NUnit.Framework;
-using WatiN.Core;
-
-namespace Platnosci.Tests.Web
-{
-    [TestFixture]
-    public class UIPlatnosciTests
-    {
-        [Test]
-        [Category("UI")]
-        public void CheckCorrectPay()
-        {
-            const string test = "test";
-            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
-            ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009");
-            ie.TextField(Find.ByName("nip")).TypeText("854956281");
-            ie.Button(Find.ById("loguj")).Click();
-
-            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
-            ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
-            ie.Button(Find.ById("place")).Click();
-            Assert.IsTrue(ie.ContainsText("Imię i nazwisko:" + test + " " + test));
-            ie.ForceClose();
-            ie.Close();
-            ie.Dispose();
-        }
-
-        [Test]
-        [Category("UI")]
-        public void CheckErrorPay()
-        {
-            const string test = "test";
-            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
-            ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009");
-            ie.TextField(Find.ByName("nip")).TypeText("854956281");
-            ie.Button(Find.ById("loguj")).Click();
-
-            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
-            ie.TextField(Find.ByName("Payer.LastName")).TypeText("");
-            ie.Button(Find.ById("place")).Click();
-            Assert.IsTrue(ie.ContainsText("Proszę podać"));
-            ie.ForceClose();
-            ie.Close();
-            ie.Dispose();
-        }
-        [Test]
-        [Category("UI")]
-        public void AmountIsZeroReturnZlyHash()
-        {
-            const string test = "test";
-            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
-            ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
-            ie.TextField(Find.ByName("nip")).TypeText("9730727417");
-            ie.Button(Find.ById("loguj")).Click();
-
-            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
-            ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
-            ie.Button(Find.ById("place")).Click();
-            Assert.IsTrue(ie.ContainsText("Wystąpił nieoczekiwany błąd"));
-            ie.ForceClose();
-            ie.Close();
-            ie.Dispose();
-            
-        }
-    }
-}
Index: /unk/eCard/eCardMVC/Platnosci.Tests/Web/UIFieldTest.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UIFieldTest.cs (revision 953)
+++  (revision )
@@ -1,46 +1,0 @@
-﻿using NUnit.Framework;
-using WatiN.Core;
-
-namespace Platnosci.Tests.Web
-{
-    [TestFixture]
-    public class UIFieldTest
-    {
-        [Test]
-        [Category("UI")]
-        public void FirstnameIsTooLong()
-        {
-            const string test = "test";
-            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
-            ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
-            ie.TextField(Find.ByName("nip")).TypeText("9730727417");
-            ie.Button(Find.ById("loguj")).Click();
-
-            ie.TextField(Find.ByName("Payer.FirstName")).TypeText("12345678901234567890123456");
-            ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
-            ie.Button(Find.ById("place")).Click();
-            Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
-            ie.ForceClose();
-            ie.Close();
-            ie.Dispose();
-        } 
-        [Test]
-        [Category("UI")]
-        public void SurnameIsTooLong()
-        {
-            const string test = "test";
-            var ie = new IE("http://localhost:3646/pl/Account/LogOn");
-            ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
-            ie.TextField(Find.ByName("nip")).TypeText("9730727417");
-            ie.Button(Find.ById("loguj")).Click();
-
-            ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
-            ie.TextField(Find.ByName("Payer.LastName")).TypeText("1234567890123456789012345678901");
-            ie.Button(Find.ById("place")).Click();
-            Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
-            ie.ForceClose();
-            ie.Close();
-            ie.Dispose();
-        } 
-    }
-}
Index: /unk/eCard/eCardMVC/Platnosci.Tests/Web/UIAccountTest.cs
===================================================================
--- /trunk/eCard/eCardMVC/Platnosci.Tests/Web/UIAccountTest.cs (revision 950)
+++  (revision )
@@ -1,37 +1,0 @@
-﻿using NUnit.Framework;
-using WatiN.Core;
-
-namespace Platnosci.Tests.Web
-{
-    [TestFixture]
-    public class UIAccountTest
-    {
-        [Test]
-        [Category("UI")]
-        public void CheckErrorLogin()
-        {
-            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 CheckLoginCorrect()
-        {
-            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();
-        }
-    }
-}
