Example #1
0
        public async Task CreateTest()
        {
            var dto = new CreateNotesDTO
            {
                CatalogName = "/小学/语文/人教版/一年级上",
                CatalogCode = "/1/1/2/1",
                Content     = "",
                Section     = new NotesComponent
                {
                    Id    = Guid.Parse("809953A6-EFF7-45E1-BAC7-477D2D0332A9"),
                    Value = "我是一个任务"
                },
                Page = new NotesComponent
                {
                    Id    = Guid.Parse("13CF28FC-25DA-4B86-96E7-FD61DA29734C"),
                    Value = "我是一个分页"
                },
            };

            var c = ContainerHelper.Builder();

            var noteSvc = c.Resolve <INotesSvc>();

            var nc = this.NC(); //new NotesController(noteSvc ,c.Resolve<IBodySvc>()
                                //           ,c.Resolve<IEntry>()
                                //          ,c.Resolve<);


            var id = await nc.CreateNotes(dto);

            Assert.IsNotNull(id);
        }
Example #2
0
        public async Task GetUserTester()
        {
            var c = ContainerHelper.Builder();

            var us = c.Resolve <IUserSvc>();

            var u = await us.GetUserAsync("05986DDB458B8F10A31D59B613D");

            Assert.NotNull(u);
        }
Example #3
0
        public async Task <NotesVO> Get(Guid id)
        {
            var c = ContainerHelper.Builder();

            var qc = new NotesQueryController(c.Resolve <INotesQuerySvc>()
                                              , c.Resolve <IBodySvc>()
                                              , c.Resolve <IAppUser>()
                                              , c.Resolve <IUserLoader>());

            var vo = await qc.Get(id.ToString());

            return(vo.Data);
        }
Example #4
0
        public NotesController NC()
        {
            var c = ContainerHelper.Builder();

            var noteSvc = c.Resolve <INotesSvc>();

            var nc = new NotesController(noteSvc
                                         , c.Resolve <IBodySvc>()
                                         , c.Resolve <IEntry>()
                                         , c.Resolve <IUserRootSvc>()
                                         , c.Resolve <IAppUser>());

            return(nc);
        }
Example #5
0
        public async Task GetSetTest()
        {
            var c = ContainerHelper.Builder();

            ICachingProvider _cp = c.Resolve <ICachingProvider>();

            var val = await _cp.Get("a", async() =>
            {
                await Task.CompletedTask;

                return("aab");
            });


            Assert.AreEqual(val, "aab");
        }
Example #6
0
        public async Task <Guid> CreateNotes(string name)
        {
            var dto = new CreateNotesDTO
            {
                CatalogName = "/小学/语文/人教版/一年级上",
                CatalogCode = "/1/1/2/1",
                Name        = name
            };

            var c = ContainerHelper.Builder();

            var noteSvc = c.Resolve <INotesSvc>();

            var nc = this.NC(); //new NotesController(noteSvc);


            var id = await nc.CreateNotes(dto);

            return(id.Data);
        }