| [930] | 1 | using NUnit.Framework;
|
|---|
| [882] | 2 | using WatiN.Core;
|
|---|
| 3 |
|
|---|
| [982] | 4 | namespace adMoto.Payments.Test.UI
|
|---|
| [882] | 5 | {
|
|---|
| 6 | [TestFixture]
|
|---|
| [960] | 7 | public class MerchantTests
|
|---|
| [882] | 8 | {
|
|---|
| [984] | 9 | private readonly UIHelper _uidata = new UIHelper();
|
|---|
| 10 |
|
|---|
| [882] | 11 | [Test]
|
|---|
| 12 | [Category("UI")]
|
|---|
| [960] | 13 | public void Redirects_To_Ecard_When_All_Details_Are_Correct()
|
|---|
| [882] | 14 | {
|
|---|
| [984] | 15 | //dodanie testowego rekordu do tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 16 | var uiData = _uidata.CreateAndAddTestRecordToRepository(2);
|
|---|
| 17 |
|
|---|
| [930] | 18 | const string test = "test";
|
|---|
| [984] | 19 | uiData.Test_surname = test;
|
|---|
| 20 | uiData.Test_firstname = test;
|
|---|
| 21 |
|
|---|
| [930] | 22 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| [984] | 23 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 24 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| [882] | 25 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 26 |
|
|---|
| 27 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| [950] | 28 | ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
|
|---|
| [882] | 29 | ie.Button(Find.ById("place")).Click();
|
|---|
| [950] | 30 | Assert.IsTrue(ie.ContainsText("Imię i nazwisko:" + test + " " + test));
|
|---|
| [960] | 31 | Assert.IsTrue(ie.Url.Contains("https://pay.ecard.pl/"));
|
|---|
| [930] | 32 | ie.ForceClose();
|
|---|
| [950] | 33 | ie.Close();
|
|---|
| 34 | ie.Dispose();
|
|---|
| [984] | 35 |
|
|---|
| 36 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 37 | _uidata.DeleteTestRecordsFromRepository(uiData);
|
|---|
| 38 |
|
|---|
| 39 | //usuniecie rekordu z tabeli PatnosciEcard
|
|---|
| 40 | _uidata.DeleteTestPaymentFromRepository(uiData);
|
|---|
| [882] | 41 | }
|
|---|
| [950] | 42 |
|
|---|
| [882] | 43 | [Test]
|
|---|
| 44 | [Category("UI")]
|
|---|
| [960] | 45 | public void Returns_ZlyHash_When_Invoice_Amount_Is_Zero()
|
|---|
| [882] | 46 | {
|
|---|
| [984] | 47 | // wartosc testowej faktury 1/SLJ/1 jest 0 (zero)
|
|---|
| [960] | 48 | // wowczas eCard powinien zwrocic zlyHash - stala informujaca, ze cos jest nie tak...
|
|---|
| [984] | 49 | var uiData = _uidata.CreateAndAddTestRecordToRepository(0);
|
|---|
| [882] | 50 |
|
|---|
| [952] | 51 | const string test = "test";
|
|---|
| [984] | 52 | uiData.Test_surname = test;
|
|---|
| 53 | uiData.Test_firstname = test;
|
|---|
| 54 |
|
|---|
| [952] | 55 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| [984] | 56 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 57 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| [952] | 58 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 59 |
|
|---|
| 60 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 61 | ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
|
|---|
| 62 | ie.Button(Find.ById("place")).Click();
|
|---|
| 63 | Assert.IsTrue(ie.ContainsText("Wystąpił nieoczekiwany błąd"));
|
|---|
| [958] | 64 | ie.ForceClose();
|
|---|
| 65 | ie.Close();
|
|---|
| 66 | ie.Dispose();
|
|---|
| [984] | 67 |
|
|---|
| 68 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 69 | _uidata.DeleteTestRecordsFromRepository(uiData);
|
|---|
| [952] | 70 | }
|
|---|
| [882] | 71 | }
|
|---|
| [950] | 72 | } |
|---|