using JamesKovacs.IoCArticle.IoCContainer.Domain;
using JamesKovacs.IoCArticle.IoCContainer.Infrastructure.Container;
using JamesKovacs.IoCArticle.IoCContainer.Services;
using MbUnit.Framework;

namespace JamesKovacs.IoCArticle.IoCContainer.Tests.Integration.Services {
    [TestFixture]
    public class InvoiceServiceTests {
        [SetUp]
        public void SetUp() {
            RhinoDependencyResolver resolver = new RhinoDependencyResolver(@".\Integration\Windsor.boo");
            IoC.Initialize(resolver);
        }

        [TearDown]
        public void TearDown() {
            IoC.Initialize(null);
        }

        [Test]
        public void CanSubmitNewInvoice() {
            Invoice invoice = new Invoice();
            IInvoiceService service = IoC.Resolve<IInvoiceService>();
            ValidationResults validationResults = service.Submit(invoice);
            Assert.IsTrue(validationResults.IsValid);
        }
    }
}