| 1 | using NUnit.Framework;
|
|---|
| 2 | using WatiN.Core;
|
|---|
| 3 |
|
|---|
| 4 | namespace adMoto.Payments.Test.UI
|
|---|
| 5 | {
|
|---|
| 6 | [TestFixture]
|
|---|
| 7 | public class ValidationTests
|
|---|
| 8 | {
|
|---|
| 9 | [Test]
|
|---|
| 10 | [Category("UI")]
|
|---|
| 11 | public void Validates_When_Firstname_Is_Too_Long()
|
|---|
| 12 | {
|
|---|
| 13 | const string test = "test";
|
|---|
| 14 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| 15 | ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
|
|---|
| 16 | ie.TextField(Find.ByName("nip")).TypeText("9730727417");
|
|---|
| 17 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 18 |
|
|---|
| 19 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText("12345678901234567890123456");
|
|---|
| 20 | ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
|
|---|
| 21 | ie.Button(Find.ById("place")).Click();
|
|---|
| 22 | Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
|
|---|
| 23 | ie.ForceClose();
|
|---|
| 24 | ie.Close();
|
|---|
| 25 | ie.Dispose();
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | [Test]
|
|---|
| 29 | [Category("UI")]
|
|---|
| 30 | public void Validates_When_Surname_Is_Too_Long()
|
|---|
| 31 | {
|
|---|
| 32 | const string test = "test";
|
|---|
| 33 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| 34 | ie.TextField(Find.ByName("numerFaktury")).TypeText("1/SLJ/2009");
|
|---|
| 35 | ie.TextField(Find.ByName("nip")).TypeText("9730727417");
|
|---|
| 36 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 37 |
|
|---|
| 38 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 39 | ie.TextField(Find.ByName("Payer.LastName")).TypeText("1234567890123456789012345678901");
|
|---|
| 40 | ie.Button(Find.ById("place")).Click();
|
|---|
| 41 | Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
|
|---|
| 42 | ie.ForceClose();
|
|---|
| 43 | ie.Close();
|
|---|
| 44 | ie.Dispose();
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | [Test]
|
|---|
| 48 | [Category("UI")]
|
|---|
| 49 | public void Validates_When_LastName_Is_Empty()
|
|---|
| 50 | {
|
|---|
| 51 | const string test = "test";
|
|---|
| 52 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| 53 | ie.TextField(Find.ByName("numerFaktury")).TypeText("27/ASZ/2009");
|
|---|
| 54 | ie.TextField(Find.ByName("nip")).TypeText("854956281");
|
|---|
| 55 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 56 |
|
|---|
| 57 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 58 | ie.TextField(Find.ByName("Payer.LastName")).TypeText("");
|
|---|
| 59 | ie.Button(Find.ById("place")).Click();
|
|---|
| 60 | Assert.IsTrue(ie.ContainsText("Proszę podać"));
|
|---|
| 61 | ie.ForceClose();
|
|---|
| 62 | ie.Close();
|
|---|
| 63 | ie.Dispose();
|
|---|
| 64 | }
|
|---|
| 65 | }
|
|---|
| 66 | } |
|---|