root/trunk/eCard/eCardMVC/adMoto.Payments.Test/UI/eCardValidationTests.cs @ 991

Wersja 991, 6.9 KB (wprowadzona przez alina, 16 years temu)

re #215 dodanie klasy bazowej dla testow interfejsowych

RevLine 
[985]1using NUnit.Framework;
2using WatiN.Core;
3
4namespace adMoto.Payments.Test.UI
5{
6    [TestFixture]
[991]7    public class eCardValidationTests : BaseTests
[985]8    {
9        private readonly UIHelper _uiHelper = new UIHelper();
[991]10        private static string adres = UIHelper.ConfirmForm;       
[985]11
[991]12        [SetUp]
13        public void SetUp()
14        {
15            System.Diagnostics.Debug.WriteLine("nowy test");
16            _uiHelper.SearchAndClean();
17            ie.GoTo(adres);
18        }
19
[985]20        [Test]
21        [Category("UI")]
22        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_Merchantnumber_Longer_Than_Fifty_Characters()
23        {
24            var merchantnumberTooLong = "123456789012345678901234567890123456789012345678901234";
25            ie.TextField(Find.ByName("MERCHANTNUMBER")).TypeText(merchantnumberTooLong);
26            ie.Button(Find.ById("dalej")).Click();
27            Assert.IsTrue(ie.ContainsText("FALSE"));
28            Assert.IsTrue(ie.ContainsText("MERCHANTNUMBER"));
[991]29        }               
[985]30               
31        [Test]
32        [Category("UI")]
33        public void Status_Returns_False_And_Throws_FormatException_When_Passing_OrderNumber_In_Wrong_Format()
34        {
35            ie.TextField(Find.ByName("ORDERNUMBER")).TypeText("aaaaaaaa");
36            ie.Button(Find.ById("dalej")).Click();
37            Assert.IsTrue(ie.ContainsText("FALSE"));
38            Assert.IsTrue(ie.ContainsText("FormatException"));
39        }
40       
41        [Test]
42        [Category("UI")]
43        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_ValidationCode_Longer_Than_Three_Characters()
44        {
45            ie.TextField(Find.ByName("VALIDATIONCODE")).TypeText("1111");
46            ie.Button(Find.ById("dalej")).Click();
47            Assert.IsTrue(ie.ContainsText("FALSE"));
48            Assert.IsTrue(ie.ContainsText("VALIDATIONCODE"));
49        }
[988]50       
[985]51        [Test]
52        [Category("UI")]
53        public void Status_Returns_False_And_Throws_FormatException_When_Passing_Authtime_Is_Wrong_Format()
54        {
55            ie.TextField(Find.ByName("AUTHTIME")).TypeText("aaaaaa");
56            ie.Button(Find.ById("dalej")).Click();
57            Assert.IsTrue(ie.ContainsText("FALSE"));
58            Assert.IsTrue(ie.ContainsText("FormatException"));
59        }
60
61        [Test]
62        [Category("UI")]
63        public void Status_Returns_False_And_Throws_SqlTypeException_When_Passing_Authtime_Is_Overflow()
64        {
65            ie.TextField(Find.ByName("AUTHTIME")).TypeText("0001-01-01 00:00:00");
66            ie.Button(Find.ById("dalej")).Click();
67            Assert.IsTrue(ie.ContainsText("FALSE"));
68            Assert.IsTrue(ie.ContainsText("SqlTypeException"));
69        }
70
71        [Test]
72        [Category("UI")]
73        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_Bin_Longer_Than_Six_Characters()
74        {
75            ie.TextField(Find.ByName("BIN")).TypeText("11111111");
76            ie.Button(Find.ById("dalej")).Click();
77            Assert.IsTrue(ie.ContainsText("FALSE"));
78            Assert.IsTrue(ie.ContainsText("BIN"));
79        }
80
81        [Test]
82        [Category("UI")]
83        public void Status_Returns_False_And_Throws_FormatException_When_Passing_EventType_In_Wrong_Format()
84        {
[990]85            ie.TextField(Find.ByName("EVENTTYPE")).TypeText("212dsf");
[985]86            ie.Button(Find.ById("dalej")).Click();
87            Assert.IsTrue(ie.ContainsText("FALSE"));
88            Assert.IsTrue(ie.ContainsText("FormatException"));
89        }
90
91        [Test]
92        [Category("UI")]
93        public void Status_Returns_False_And_Throws_FormatException_When_Passing_PaymentNumber_In_Wrong_Format()
94        {
95            ie.TextField(Find.ByName("PAYMENTNUMBER")).TypeText("AAAA");
96            ie.Button(Find.ById("dalej")).Click();
97            Assert.IsTrue(ie.ContainsText("FALSE"));
98            Assert.IsTrue(ie.ContainsText("FormatException"));
99        }
100
101        [Test]
102        [Category("UI")]
103        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_PreviousState_Longer_Than_Fifty_Characters()
104        {
105            var previousstateTooLong = "123456789012345678901234567890123456789012345678901234";
106            ie.TextField(Find.ByName("PREVIOUSSTATE")).TypeText(previousstateTooLong);
107            ie.Button(Find.ById("dalej")).Click();
108            Assert.IsTrue(ie.ContainsText("FALSE"));
109            Assert.IsTrue(ie.ContainsText("PREVIOUSSTATE"));
110        }
111
112        [Test]
113        [Category("UI")]
114        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_CurrentState_Longer_Than_Fifty_Characters()
115        {
116            var currentstateTooLong = "123456789012345678901234567890123456789012345678901234";
117            ie.TextField(Find.ByName("CURRENTSTATE")).TypeText(currentstateTooLong);
118            ie.Button(Find.ById("dalej")).Click();
119            Assert.IsTrue(ie.ContainsText("FALSE"));
120            Assert.IsTrue(ie.ContainsText("CURRENTSTATE"));
121        }
122
123        [Test]
124        [Category("UI")]
125        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_ApprovalCode_Longer_Than_Fifty_Characters()
126        {
127            var approvalcodeTooLong = "123456789012345678901234567890123456789012345678901234";
128            ie.TextField(Find.ByName("APPROVALCODE")).TypeText(approvalcodeTooLong);
129            ie.Button(Find.ById("dalej")).Click();
130            Assert.IsTrue(ie.ContainsText("FALSE"));
131            Assert.IsTrue(ie.ContainsText("APPROVALCODE"));
132        }
133
134        [Test]
135        [Category("UI")]
136        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_CommType_Longer_Than_Fifty_Characters()
137        {
138            var commtypeTooLong = "123456789012345678901234567890123456789012345678901234";
139            ie.TextField(Find.ByName("COMMTYPE")).TypeText(commtypeTooLong);
140            ie.Button(Find.ById("dalej")).Click();
141            Assert.IsTrue(ie.ContainsText("FALSE"));
142            Assert.IsTrue(ie.ContainsText("COMMTYPE"));
143        }
144
145        [Test]
146        [Category("UI")]
147        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_Type_Longer_Than_Two_Characters()
148        {
149            ie.TextField(Find.ByName("TYPE")).TypeText("11222");
150            ie.Button(Find.ById("dalej")).Click();
151            Assert.IsTrue(ie.ContainsText("FALSE"));
152            Assert.IsTrue(ie.ContainsText("TYPE"));
153        }
154
155        [Test]
156        [Category("UI")]
157        public void Status_Returns_False_And_Throws_ArgumentException_When_Passing_WithCvc_Longer_Than_Three_Characters()
158        {
159            ie.TextField(Find.ByName("WITHCVC")).TypeText("1112");
160            ie.Button(Find.ById("dalej")).Click();
161            Assert.IsTrue(ie.ContainsText("FALSE"));
162            Assert.IsTrue(ie.ContainsText("WITHCVC"));
163        }     
164       
165    }
166}
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.