root/trunk/eCard/eCardMVC/Platnosci.Tests/Web/TestMethods.cs @ 882

Wersja 882, 1.4 KB (wprowadzona przez alina, 16 years temu)

re #215 testowanie interfejsu (dot.Pay)

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using NUnit.Framework;
6using Platnosci.Core.Linq;
7using Platnosci.Core.Interface;
8
9namespace Platnosci.Tests.Web
10{
11    [TestFixture]
12    class TestMethods
13    {
14        private string testNip1 = "12345";
15        private int testIdFaktury = 1000;
16
17        private Function _f = new Function();
18
19        [Test]
20        [Category("Unit")]
21        public void TestFindInvoiceByNumber()
22        {
23            FakeDataContext fake = new FakeDataContext();
24            IRepository<vPlatnosciEcard> _rep = new Repository<vPlatnosciEcard>(fake);
25
26            vPlatnosciEcard platnosc = new vPlatnosciEcard();
27            platnosc = _rep.FindInvoiceById(1).SingleOrDefault();
28            Assert.That(platnosc.Faktura_Numer, Is.EqualTo("1"));
29        }
30        [Test]
31        [Category("Unit")]
32        public void TestInsertMethodForPayment()
33        {
34            FakeDataContext fake = new FakeDataContext();
35            IRepository<vPlatnosciEcard> _rep = new Repository<vPlatnosciEcard>(fake);
36
37            vPlatnosciEcard platnosc = _f.createPayment(testIdFaktury, testNip1, "", 0, 0);
38            _rep.Insert(platnosc);
39
40            vPlatnosciEcard pl = _rep.FindInvoiceById(testIdFaktury).SingleOrDefault();
41            Assert.That(pl.nip, Is.EqualTo(testNip1));
42        }
43    }
44}
Notatka: Zobacz TracBrowser aby uzyskać więcej informacji.