示例#1
0
文件: ReplyBot.cs 项目: ac682/arcbot
        public override void OnGroupMessage(object sender, GroupMessageEventArgs args)
        {
            var reply = _service.Get(args.Message.AsReadable(), args.Group.Identity);

            if (reply != null)
            {
                args.Group.SendAsync(reply.Reply.MakeMessageChain()).Wait();
            }
        }
示例#2
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IReplyRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Reply>(null));
            var service = new ReplyService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ReplyModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLReplyMapperMock,
                                           mock.DALMapperMockFactory.DALReplyMapperMock);

            ApiReplyResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }