????????????????????????????????????????????????????????????????????????????????????壬??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

???????????????????????Rhino Mock??????????????????????????????????????????????????????????????????????????????protected????????????????????????????????????????????????nHibernate??????????????????

??????????

public class When_create_an_exam
    {
        private Establish context =
            () =>
                {
                    stub_exam_def = MockRepository.GenerateMock<ExamDef>();
                    stub_district = MockRepository.GenerateMock<District>();
                    stub_date = MockRepository.GenerateMock<Date>();
                };
    //...?????????????????
    }

?????????????????ε????????????????????????????????????????????????????

????AutoMocking --- ????????

?????????????????????????????????????????????

??????????AutoMocking???????????????????AutoMock??Specification???????????????????????????????subject?????????????????????????????壬???????????????????????Щ???????????

???????Dependency<ExamDef>?????????????????????????????????????---?????????

???????????

public class When_create_an_exam:Specification<Exam>
    {
        private It should_assign_to_properties =
            () =>
                {
                    subject.District.ShouldEqual(DependencyOf<District>());
                    subject.ExamDef.ShouldEqual(DependencyOf<ExamDef>());
                    subject.Date.ShouldEqual(DependencyOf<Date>());
                };
    }

????????????????????в????????????????????