public void TryFindUnsuccessful()
        {
            var factory = new LocatorXmlMappingEngineFactory(this.Container.Resolve<IServiceLocator>());
            IXmlMappingEngine candidate;
            var result = factory.TryFind("Css.V1", out candidate);

            Assert.IsFalse(result, "Result is truel");
            Assert.IsNull(candidate, "Candidate not null");
        }
        public void FindSuccessful()
        {
            var expected = new Mock<IXmlMappingEngine>();
            this.Container.RegisterInstance(typeof(IXmlMappingEngine), "Css.V1", expected.Object, new ContainerControlledLifetimeManager());

            var factory = new LocatorXmlMappingEngineFactory(this.Container.Resolve<IServiceLocator>());
            var candidate = factory.Find("Css.V1");

            Assert.AreSame(expected.Object, candidate);
        }
        public void TryFindSuccessful()
        {
            var expected = new Mock<IXmlMappingEngine>();
            this.Container.RegisterInstance(typeof(IXmlMappingEngine), "Css.V1", expected.Object, new ContainerControlledLifetimeManager());
            expected.Setup(x => x.Context).Returns(new Context());

            var factory = new LocatorXmlMappingEngineFactory(this.Container.Resolve<IServiceLocator>());
            IXmlMappingEngine candidate;
            var result = factory.TryFind("Css.V1", out candidate);

            Assert.IsTrue(result, "Result is false");
            Assert.AreSame(expected.Object, candidate);
        }
        public void FindSuccessful()
        {
            var expected = new Mock<IXmlMappingEngine>();
            var context = new Context();
            this.Container.RegisterInstance(typeof(IXmlMappingEngine), "Css.V1", expected.Object, new ContainerControlledLifetimeManager());
            expected.Setup(x => x.Context).Returns(context);

            var factory = new LocatorXmlMappingEngineFactory(this.Container.Resolve<IServiceLocator>());
            var candidate = factory.Find("Css.V1");

            Assert.AreSame(expected.Object, candidate);
            Assert.That(new Version(1, 0).Major, Is.EqualTo(context.Value<Version>("SchemaReleaseVersion").Major));
        }
        public void FindUnsuccessful()
        {
            var factory = new LocatorXmlMappingEngineFactory(this.Container.Resolve<IServiceLocator>());

            try
            {
                factory.Find("Css.V1");

                throw new Exception("Factory did not throw");
            }
            catch (MappingException)
            {
            }
        }