using System;
using JamesKovacs.IoCArticle.DiyContainer.Infrastructure.Container;
using MbUnit.Framework;

namespace JamesKovacs.IoCArticle.DiyContainer.Tests.Unit.Infrastructure.Container {
    [TestFixture]
    public class SimpleDependencyResolverTests {
        [Test]
        public void CanRegisterValidDependency() {
            SimpleDependencyResolver resolver = new SimpleDependencyResolver();
            resolver.Register<IFoo>(new Foo());
        }

        [Test, ExpectedException(typeof(InvalidOperationException))]
        public void RegisteringInvalidDependencyThrowsInvalidOperationException() {
            SimpleDependencyResolver resolver = new SimpleDependencyResolver();
            resolver.Register<IFoo>(new object());
        }
    }
}