Exemple #1
0
        static void Main(string[] args)
        {
            Ninject.IKernel kernal = new StandardKernel(new Core());
            ////kernal.Bind<IMsgRepo>().To<MsgRepo>();
            _repo = kernal.Get<MsgRepo>();

            _svc = kernal.Get<MsgService>();

            var svcreplies = _svc.GetReplies();
            foreach (var x in svcreplies)
            {
                Console.WriteLine(x.Body);
            }

            Console.WriteLine("enter reply");
            var consoleReply = Console.ReadLine();

            var reply = new Reply()
            {
                Body = consoleReply,
                Created = DateTime.Now,
                TopicId = 1

            };

            _repo.InsertReply(reply);

            var replies = _repo.GetReplies();
            _repo.DeleteReply(replies.First().Id);

            foreach (var x in replies)
            {
                Console.WriteLine(x.Body);
            }

            Main(args);

            //var baseClass = new BaseClass();
            //var derivedOverride = new DerivedOverride();
            //var derivedNew = new DerivedNew();
            //var derivedOverWrite = new DerivedOverwrite();

            //baseClass.Name();
            //derivedOverride.Name();
            //derivedNew.Name();
            //derivedOverWrite.Name();

            //Console.ReadLine();
            //baseClass.Name();
            //derivedOverride.Name();
            //((BaseClass)derivedNew).Name();
            //((BaseClass)derivedOverWrite).Name();
            //Console.ReadLine();

            //var t1 = typeof(BaseClass);
            //Console.WriteLine(t1.Name);
            //Console.WriteLine(t1.Assembly);

            //Console.ReadLine();
        }
Exemple #2
0
 public void Initialize(
     IMsgRepo msgRepo,
     IMessageLogicFactory messageLogicFactory)
 {
     _msgRepo             = msgRepo;
     _messageLogicFactory = messageLogicFactory;
 }
Exemple #3
0
        public void Initialize(
            IUIController uiController,
            IMsgRepo msgRepo,
            INetworkManager network,
            XiaoMiManager xiaoMiManager,
            IAnalyticManager analyticManager,
            ConfigHolder configHolder,
            IAnySDKManager anySdkManager,
            IosSDK ios,
            IWeChatManager weChatManager,
            IDataRepository dataRepository,
            LocalGameServer localGameServer)
        {
            _uiController    = uiController;
            _ios             = ios;
            _network         = network;
            _msgRepo         = msgRepo;
            _configHolder    = configHolder;
            _xiaoMiManager   = xiaoMiManager;
            _weChatManager   = weChatManager;
            _analyticManager = analyticManager;
            _localGameServer = localGameServer;
            _anySdkManager   = anySdkManager;

            _appState          = dataRepository.GetContainer <AppState>(DataKey.AppState);
            _versionResult     = dataRepository.GetContainer <VersionResult>(DataKey.VersionResult);
            _pLoginResult      = dataRepository.GetContainer <PLoginResult>(DataKey.PLoginResult);
            _billboardRead     = dataRepository.GetContainer <bool>(DataKey.BillboardRead);
            _currentGameMode   = dataRepository.GetContainer <int>(DataKey.CurrentGameMode);
            _vipExchangeList   = dataRepository.GetContainer <VipExchangeListResult>(DataKey.VipExchangeListResult);
            _treasureChestData = dataRepository.GetContainer <TreasureChestData>(DataKey.TreasureChestData);
            _hloginResult      = dataRepository.GetContainer <HLoginResult>(DataKey.HLoginResult);
            _friendListResult  = dataRepository.GetContainer <SFriendListResult>(DataKey.SFriendListResult);
        }
Exemple #4
0
        public RepositoryMock()
        {
            List<Reply> replies = new List<Reply>
            {

                new Reply(){Body = "bdy1", Id = 1, TopicId = 1, Created = DateTime.Now},
                new Reply(){Body = "bdy2", Id = 2, TopicId = 1, Created = DateTime.Now},
                new Reply(){Body = "bdy3", Id = 3, TopicId = 1, Created = DateTime.Now},
                new Reply(){Body = "bdy4", Id = 4, TopicId = 1, Created = DateTime.Now}
            };

            Mock<IMsgRepo> mockRepo = new Mock<IMsgRepo>();
            mockRepo.Setup(m => m.GetReplies()).Returns(replies.AsQueryable);

            mockRepo.Setup(m => m.FindById(
                It.IsAny<int>()))
                .Returns((int i) => replies.Single(x => x.Id == i));

            mockRepo.Setup(m => m.DeleteReply(It.IsAny<int>()))
                .Returns(
                    (int deleteId) =>
                    {
                        var replyToDelete = replies.Single(r => r.Id == deleteId);
                        replies.Remove(replyToDelete);
                        return true;
                    });

            mockRepo.Setup(m => m.InsertReply(
                It.IsAny<Reply>())).Returns(
                    (Reply target) =>
                    {
                        DateTime now = DateTime.Now;
                        if (target.Id.Equals(default(int)))
                        {
                            target.Created = now;
                            target.Id = replies.Count() + 1;
                            replies.Add(target);

                        }
                        else
                        {
                            var orig = replies.Single(r => r.Id == target.Id);
                            if (orig == null)
                                return false;

                            orig.Body = target.Body;
                            orig.Created = now;
                            orig.TopicId = target.TopicId;

                        }
                        return true;
                    }

                );

            MockRepo = mockRepo.Object;
        }
Exemple #5
0
        public void Initialize(
            IMsgRepo msgRepo,
            IAppController appController,
            ISoundController soundController,
            IMessageRouter messageRouter,
            INetworkManager network,
            ITaskManager taskManager,
            IDialogManager dialogManager,
            IAnalyticManager analyticManager,
            ConfigHolder configHolder,
            IDataRepository dataRepository,
            IClipboardManager clipboardManager)
        {
            _msgRepo          = msgRepo;
            _appController    = appController;
            _soundController  = soundController;
            _messageRouter    = messageRouter;
            _network          = network;
            _taskManager      = taskManager;
            _analyticManager  = analyticManager;
            _dialogManager    = dialogManager;
            _configHolder     = configHolder;
            _clipboardManager = clipboardManager;

            _dataRepository           = dataRepository;
            _myUser                   = dataRepository.GetContainer <User>(DataKey.MyUser);
            _requestAwardResult       = dataRepository.GetContainer <RequestAwardResult>(DataKey.RequestAwardResult);
            _chooseRoomResult         = dataRepository.GetContainer <ChooseRoomResult>(DataKey.ChooseRoomResult);
            _chooseRoomFail           = dataRepository.GetContainer <ChooseRoomFail>(DataKey.ChooseRoomFail);
            _leaveRoomResult          = dataRepository.GetContainer <LeaveRoomResult>(DataKey.LeaveRoomResult);
            _chooseTableResult        = dataRepository.GetContainer <ChooseTableResult>(DataKey.ChooseTableResult);
            _leaveTableResult         = dataRepository.GetContainer <LeaveTableResult>(DataKey.LeaveTableResult);
            _currentRoom              = dataRepository.GetContainer <Room>(DataKey.CurrentRoom);
            _playingData              = dataRepository.GetContainer <PlayingData>(DataKey.PlayingData);
            _tableUserData            = dataRepository.GetContainer <TableUserData>(DataKey.TableUserData);
            _exchangeResult           = dataRepository.GetContainer <ExchangeResult>(DataKey.ExchangeResult);
            _requestExchangeVipResult =
                dataRepository.GetContainer <RequestExchangeVipResult>(DataKey.RequestExchangeVipResult);
            _tradeNoResult              = dataRepository.GetContainer <TradeNoResult>(DataKey.TradeNoResult);
            _checkTradeResult           = dataRepository.GetContainer <CheckTradeResult>(DataKey.CheckTradeResult);
            _searchUserResult           = dataRepository.GetContainer <CUSearchUserResult>(DataKey.SearchUserResult);
            _friendDetailResult         = dataRepository.GetContainer <SFriendDetailResult>(DataKey.SFriendDetailResult);
            _removeFriendResultToSender =
                dataRepository.GetContainer <SRemoveFriendResultToSender>(DataKey.SRemoveFriendResultToSender);
            _traceUserResult       = dataRepository.GetContainer <TraceUserResult>(DataKey.TraceUserResult);
            _exchangeYuanBaoResult = dataRepository.GetContainer <ExchangeYuanBaoResult>(DataKey.ExchangeYuanBaoResult);
        }
 public void Inject(
     IAppController appController,
     INetworkManager network,
     IGameCanvas gameCanvas,
     ITaskManager taskManager,
     IDialogManager dialogManager,
     IPayManager payManager,
     IAnalyticManager analyticManager,
     ISystemMsgController systemMsgController,
     ISoundController soundController,
     IWeChatManager weChatManager,
     RemoteAPI remoteAPI,
     ConfigHolder configHolder,
     IosSDK iosSDK,
     IPIPLogic pipLogic,
     IClipboardManager clipboardManager,
     ISocketFactory socketFactory,
     IMessageRouter messageRouter,
     IMsgRepo msgRepo,
     XiaoMiManager xiaoMiManager,
     IResourceManager resourceManager,
     IDataRepository dataRepository)
 {
     _network             = network;
     _taskManager         = taskManager;
     _appController       = appController;
     _gameCanvas          = gameCanvas;
     _dialogManager       = dialogManager;
     _payManager          = payManager;
     _analyticManager     = analyticManager;
     _systemMsgController = systemMsgController;
     _soundController     = soundController;
     _weChatManager       = weChatManager;
     _remoteAPI           = remoteAPI;
     _configHolder        = configHolder;
     _iosSDK           = iosSDK;
     _socketFactory    = socketFactory;
     _pipLogic         = pipLogic;
     _messageRouter    = messageRouter;
     _msgRepo          = msgRepo;
     _xiaoMiManager    = xiaoMiManager;
     _dataRepository   = dataRepository;
     _clipboardManager = clipboardManager;
     _resourceManager  = resourceManager;
 }
Exemple #7
0
        public void OnEnable()
        {
            MsgRepo = new MsgRepo();

            title = "支付测试";

            _prepayment                = new Prepayment();
            _prepayment.name           = "TestPrepayment";
            _prepayment.display_name   = "测试支付包";
            _prepayment.description    = "充值即可获得大礼哦";
            _prepayment.currency_type  = CurrencyType.GOLDEN_EGG;
            _prepayment.currency_count = 20000;
            _prepayment.price          = 6;
            _prepayment.pay_channel.Add(PayChannelType.IOS_IAP);
            _prepayment.pay_channel.Add(PayChannelType.ALIPAY_IOS);
            _prepayment.pay_channel.Add(PayChannelType.ALIPAY_CLIENT);

            _trade              = new Trade();
            _trade.pay_channel  = PayChannelType.ALIPAY_IOS;
            _trade.out_trade_no = "KSLDHGKL21934";
        }
Exemple #8
0
 public SetNoticeReadHandler(IMsgRepo msgRepo)
 {
     NeedVerifyUser = true;
     _msgRepo       = msgRepo;
 }
Exemple #9
0
 public MsgService(IMsgRepo repo)
 {
     _repo = repo;
 }
Exemple #10
0
 public ReadNoticeHandler(IMsgRepo msgRepo)
 {
     NeedVerifyUser = true;
     _msgRepo       = msgRepo;
 }
Exemple #11
0
 public SendMsgHandler(IEventPublisher eventPublisher, IMsgRepo msgRepo)
 {
     NeedVerifyUser  = true;
     _eventPublisher = eventPublisher;
     _msgRepo        = msgRepo;
 }
Exemple #12
0
 public ReadTalkMsgsHandler(IMsgRepo msgRepo)
 {
     NeedVerifyUser = true;
     _msgRepo       = msgRepo;
 }
Exemple #13
0
 public ReadRecentTalkHandler(IMsgRepo msgRepo, ModelBuilder modelBuilder)
 {
     NeedVerifyUser = true;
     _msgRepo       = msgRepo;
     _modelBuilder  = modelBuilder;
 }
 public void Initialize(IMsgRepo msgRepo)
 {
     _msgRepo = msgRepo;
 }