| 1 | using System;
|
|---|
| 2 | using adMoto.Payments.Core;
|
|---|
| 3 | using adMoto.Payments.Core.Data;
|
|---|
| 4 | using System.Web.Mvc;
|
|---|
| 5 | using Moq;
|
|---|
| 6 |
|
|---|
| 7 | namespace adMoto.Payments.Test.Fakes
|
|---|
| 8 | {
|
|---|
| 9 | public class TestDataHelper
|
|---|
| 10 | {
|
|---|
| 11 | public Invoice CreateInvoice(int id, string nip, string invoiceNumber, decimal brutto, byte systemKsiegowy)
|
|---|
| 12 | {
|
|---|
| 13 | var platnosc = new Invoice();
|
|---|
| 14 | platnosc.ID_faktury = id;
|
|---|
| 15 | platnosc.nip = nip;
|
|---|
| 16 | platnosc.Faktura_Numer = invoiceNumber;
|
|---|
| 17 | platnosc.Brutto = brutto;
|
|---|
| 18 | platnosc.SystemKsiegowyId = systemKsiegowy;
|
|---|
| 19 |
|
|---|
| 20 | return platnosc;
|
|---|
| 21 | }
|
|---|
| 22 | public Invoice CreateForeignInvoice(int id, string nip, string invoiceNumber, decimal brutto, byte systemKsiegowy, decimal walutaBrutto, string currency)
|
|---|
| 23 | {
|
|---|
| 24 | var platnosc = new Invoice();
|
|---|
| 25 | platnosc.ID_faktury = id;
|
|---|
| 26 | platnosc.nip = nip;
|
|---|
| 27 | platnosc.Faktura_Numer = invoiceNumber;
|
|---|
| 28 | platnosc.Brutto = brutto;
|
|---|
| 29 | platnosc.waluta_brutto = walutaBrutto;
|
|---|
| 30 | platnosc.waluta_miano = currency.ToUpper();
|
|---|
| 31 | platnosc.SystemKsiegowyId = systemKsiegowy;
|
|---|
| 32 |
|
|---|
| 33 | return platnosc;
|
|---|
| 34 | }
|
|---|
| 35 | public PlatnosciEcard CreateNewPayment(int orderNumber, bool status, DateTime data, int invoiceId)
|
|---|
| 36 | {
|
|---|
| 37 | var platnosc = new PlatnosciEcard();
|
|---|
| 38 | platnosc.ORDERNUMBER = orderNumber;
|
|---|
| 39 | platnosc.Status = status;
|
|---|
| 40 | platnosc.Status_data = data;
|
|---|
| 41 | platnosc.IDFaktury = invoiceId;
|
|---|
| 42 |
|
|---|
| 43 | return platnosc;
|
|---|
| 44 | }
|
|---|
| 45 | public PotwierdzeniaEcard CreateConfirm(string code, int ordernumber)
|
|---|
| 46 | {
|
|---|
| 47 | var potwierdzenie = new PotwierdzeniaEcard();
|
|---|
| 48 | potwierdzenie.CURRENTSTATE = code;
|
|---|
| 49 | potwierdzenie.ORDERNUMBER = ordernumber;
|
|---|
| 50 |
|
|---|
| 51 | return potwierdzenie;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | public Payer CreatePayer(int id, string name, string surname)
|
|---|
| 55 | {
|
|---|
| 56 | var payer = new Payer {Id_faktury = id, FirstName = name, LastName = surname};
|
|---|
| 57 |
|
|---|
| 58 | return payer;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | public ControllerContext CreateControllerContext(string userIdentity)
|
|---|
| 62 | {
|
|---|
| 63 |
|
|---|
| 64 | var mock = new Mock<ControllerContext>();
|
|---|
| 65 | mock.SetupGet(m => m.HttpContext.User.Identity.Name).Returns(userIdentity);
|
|---|
| 66 | mock.SetupGet(m => m.HttpContext.Request.IsAuthenticated).Returns(true);
|
|---|
| 67 |
|
|---|
| 68 | return mock.Object;
|
|---|
| 69 | }
|
|---|
| 70 | }
|
|---|
| 71 | } |
|---|