コード例 #1
0
        public void GetStudentInformationTest()
        {
            var studentAppService  = new StudentAppService();
            var studentInformation = studentAppService.GetStudentInformation();

            Assert.NotEqual(studentInformation, null);
        }
コード例 #2
0
        /// <summary>
        /// 注册实例对象
        /// 【RegisterInstance】
        /// </summary>
        /// <param name="builder"></param>
        /// <returns></returns>
        protected override Autofac.ContainerBuilder RegisterFunc(Autofac.ContainerBuilder builder)
        {
            var stuRepository = new StudentRepository();

            builder.RegisterInstance(stuRepository).As <IStudentRepository>();

            var stuService = new StudentAppService(stuRepository);

            builder.RegisterInstance(stuService).As <IStudentAppService>();

            return(builder);
        }