Beispiel #1
0
        public void store_and_retrieve_backs_up_by_the_system()
        {
            var returnValue = new SomethingThatDoesNotExist();

            var context = new TestContext()
            {
                BackupResolver = t =>
                {
                    if (t == typeof(ISomethingThatDoesNotExist))
                    {
                        return(returnValue);
                    }

                    throw new ApplicationException("Unexpected Type:  " + t.FullName);
                }
            };

            context.Retrieve(typeof(ISomethingThatDoesNotExist)).ShouldBeTheSameAs(returnValue);
            context.Retrieve <ISomethingThatDoesNotExist>().ShouldBeTheSameAs(returnValue);
        }
        public void store_and_retrieve_backs_up_by_the_system()
        {
            var returnValue = new SomethingThatDoesNotExist();

            var context = new TestContext()
            {
                BackupResolver = t =>
                {
                    if (t == typeof(ISomethingThatDoesNotExist)) return returnValue;

                    throw new ApplicationException("Unexpected Type:  " + t.FullName);
                }
            };

            context.Retrieve(typeof (ISomethingThatDoesNotExist)).ShouldBeTheSameAs(returnValue);
            context.Retrieve<ISomethingThatDoesNotExist>().ShouldBeTheSameAs(returnValue);
        }
        public void store_and_retrieve_backs_up_by_the_system()
        {
            var returnValue = new SomethingThatDoesNotExist();

            var execution = new SimpleExecutionContext();
            execution.Services.Add<ISomethingThatDoesNotExist>(returnValue);
            var context = new TestContext(execution, new Test("a"), new ConsoleListener());

            context.Retrieve(typeof (ISomethingThatDoesNotExist)).ShouldBeTheSameAs(returnValue);
            context.Retrieve<ISomethingThatDoesNotExist>().ShouldBeTheSameAs(returnValue);
        }