コード例 #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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public void store_and_retrieve()
        {
            var context = new TestContext();
            var data = new SomeContext();

            context.Store(data);

            context.Retrieve<SomeContext>().ShouldBeTheSameAs(data);
        }