示例#1
0
        public void the_test_is_available_in_the_test_context()
        {
            var test    = new Test("some test");
            var context = new TestContext(new Container(), test, new ConsoleListener());

            context.Retrieve <Test>().ShouldBeTheSameAs(test);
        }
示例#2
0
        public void store_and_retrieve()
        {
            var context = new TestContext();
            var data    = new SomeContext();

            context.Store(data);

            context.Retrieve <SomeContext>().ShouldBeTheSameAs(data);
        }
示例#3
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 the_test_is_available_in_the_test_context()
        {
            var test = new Test("some test");
            var context = new TestContext(new Container(), test, new ConsoleListener());

            context.Retrieve<Test>().ShouldBeTheSameAs(test);
        }
        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()
        {
            var context = new TestContext();
            var data = new SomeContext();

            context.Store(data);

            context.Retrieve<SomeContext>().ShouldBeTheSameAs(data);
        }
        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);
        }
 public void retrieving_ITestContext_always_returns_itself()
 {
     var context = new TestContext();
     context.Retrieve<ITestContext>().ShouldBeTheSameAs(context);
 }
        public void can_retrieve_its_own_test()
        {
            var execution = new SimpleExecutionContext();
            var test = new Test("soemthing");
            var context = new TestContext(execution, test, new ConsoleListener());

            context.Retrieve(typeof (Test)).ShouldBeTheSameAs(test);
            context.Retrieve<Test>().ShouldBeTheSameAs(test);
        }