| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Linq;
|
|---|
| 4 | using System.Web;
|
|---|
| 5 | using Platnosci.Core.Interface;
|
|---|
| 6 | using Platnosci.Core.Linq;
|
|---|
| 7 |
|
|---|
| 8 | namespace Platnosci.Tests.Web
|
|---|
| 9 | {
|
|---|
| 10 | public class FakeDataContext : IDataContext
|
|---|
| 11 | {
|
|---|
| 12 | private List<PlatnosciEcard> listaPayment = new List<PlatnosciEcard>();
|
|---|
| 13 |
|
|---|
| 14 | private string code_Ok = "payment_deposited"; //transakcja potwierdzona do rozliczenia
|
|---|
| 15 |
|
|---|
| 16 | private readonly List<object> lista = new List<object>();
|
|---|
| 17 | private Function _f = new Function();
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | public IQueryable<T> GetTable<T>() where T : class
|
|---|
| 21 | {
|
|---|
| 22 | var query = lista.Where(objects => typeof(T).IsAssignableFrom(objects.GetType()));
|
|---|
| 23 | return query.Select(o => (T)o).AsQueryable();
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | public void Insert<T>(T item) where T : class
|
|---|
| 27 | {
|
|---|
| 28 | lista.Add(item);
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | public void Delete<T>(T item) where T : class
|
|---|
| 32 | {
|
|---|
| 33 | lista.Remove(item);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | public void SubmitChanges()
|
|---|
| 37 | {
|
|---|
| 38 | InvokeCompleted(EventArgs.Empty);
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | public event EventHandler Completed;
|
|---|
| 42 |
|
|---|
| 43 | private void InvokeCompleted(EventArgs e)
|
|---|
| 44 | {
|
|---|
| 45 | var completedHandler = Completed;
|
|---|
| 46 | if (completedHandler != null) completedHandler(this, e);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | public void Dispose()
|
|---|
| 50 | {
|
|---|
| 51 | }
|
|---|
| 52 | public IQueryable<vPlatnosciEcard> FindInvoiceByNipNumber(string nip, string numer)
|
|---|
| 53 | {
|
|---|
| 54 | throw new NotImplementedException();
|
|---|
| 55 | }
|
|---|
| 56 | public List<PotwierdzeniaEcard> FindItemsByIdFaktury(int idFaktury)
|
|---|
| 57 | {
|
|---|
| 58 |
|
|---|
| 59 | PlatnosciEcard platnosc = _f.createNewPayment(123456, true, DateTime.Now, 123);
|
|---|
| 60 | List<PlatnosciEcard> payment = new List<PlatnosciEcard>();
|
|---|
| 61 | List<PotwierdzeniaEcard> listaConfirm = new List<PotwierdzeniaEcard>();
|
|---|
| 62 | listaConfirm.Add((PotwierdzeniaEcard)lista[0]);
|
|---|
| 63 | payment.Add(platnosc);
|
|---|
| 64 |
|
|---|
| 65 | List<PotwierdzeniaEcard> new_confirm = new List<PotwierdzeniaEcard>();
|
|---|
| 66 |
|
|---|
| 67 | if (platnosc.IDFaktury == idFaktury)
|
|---|
| 68 | {
|
|---|
| 69 | if (listaConfirm[0].ORDERNUMBER == platnosc.ORDERNUMBER && listaConfirm[0].CURRENTSTATE == code_Ok)
|
|---|
| 70 | new_confirm.Add(listaConfirm[0]);
|
|---|
| 71 | }
|
|---|
| 72 | System.Diagnostics.Debug.WriteLine("lista" + new_confirm.Count());
|
|---|
| 73 | return new_confirm;
|
|---|
| 74 | }
|
|---|
| 75 | public int GetOrdernumber(string desc, int? id, DateTime? data)
|
|---|
| 76 | {
|
|---|
| 77 | throw new NotImplementedException();
|
|---|
| 78 | }
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|