﻿using NUnit.Framework;
using Platnosci.Core.Linq;

namespace Platnosci.Tests.Web
{
    [TestFixture]
    class TestMethods
    {
        private readonly Function _function = new Function();

        [Test]
        [Category("Unit")]
        public void TestInsertMethodForPayment()
        {
            var fake = new FakeDataContext();
            var vPlatnosciEcardRepository = new Repository<vPlatnosciEcard>(fake);

            var platnosc = _function.CreateInvoice(123, "nip", "", 0, 0);
            vPlatnosciEcardRepository.Insert(platnosc);

            System.Diagnostics.Debug.WriteLine("rep.Count: " + vPlatnosciEcardRepository.Count());            
            var pl = vPlatnosciEcardRepository.FindOne(123);
            System.Diagnostics.Debug.WriteLine("Wartosc nip ma byc 'nip'. Jest " + pl.nip);
            Assert.That(pl.nip, Is.EqualTo("nip"));
        }
    }
}
