Exemplo n.º 1
0
        // Helper Methods
        private TipService CreateTipService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new TipService(userId);

            return(service);
        }
Exemplo n.º 2
0
        public IHttpActionResult Get()
        {
            TipService tipService = CreateTipService();
            var        tips       = tipService.GetTips();

            return(Ok(tips));
        }
Exemplo n.º 3
0
        public IHttpActionResult Get(int id)
        {
            TipService tipService = CreateTipService();
            var        tip        = tipService.GetTipByID(id);

            return(Ok(tip));
        }
Exemplo n.º 4
0
        // GET: Tip/Edit/5
        public ActionResult Edit(int id)
        {
            TipService tipSrv = new TipService();
            Tip        tip    = tipSrv.Obter(id);

            return(View("Create", tip));
        }
Exemplo n.º 5
0
 public void BeforeEachTest()
 {
     _userBalanceRepository        = new Mock <IUserBalanceRepository>();
     _userBalanceHistoryRepository = new Mock <IUserBalanceHistoryRepository>();
     _userBalanceHistoryRepository = new Mock <IUserBalanceHistoryRepository>();
     _withdrawalRepositoryMock     = new Mock <IWithdrawalRepository>();
     _sut = new TipService(_userBalanceRepository.Object, _userBalanceHistoryRepository.Object, _withdrawalRepositoryMock.Object);
 }
        public void TestThatTenGenerosityReturnsTenPercentTip()
        {
            // Arrange
            var tip = new TipService();

            // Act
            var result = tip.Calc(42.35, 10);

            // Assert
            Assert.AreEqual(4.235, result);
        }
        public void TestThatZeroGenerosityReturnsZeroTip()
        {
            // Arrange
            var tip = new TipService();

            // Act
            var result = tip.Calc(42.35, 0);

            // Assert
            Assert.AreEqual(0, result);
        }
Exemplo n.º 8
0
 public ActionResult Edit(Tip model)
 {
     if (ModelState.IsValid)
     {
         TipService tipSrv = new TipService();
         tipSrv.Salvar(model);
         return(View("List", tipSrv.Listar()));
     }
     else
     {
         return(View("Create", model));
     }
 }
Exemplo n.º 9
0
 public ActionResult Create(Tip model)
 {
     if (ModelState.IsValid)
     {
         model.Autor = User.Identity.Name;
         TipService srv = new TipService();
         srv.Salvar(model);
         return(View("Index", srv.Listar()));
     }
     else
     {
         return(View(model));
     }
 }
Exemplo n.º 10
0
 public TipCommand(TipService _tipService, TipEmbedService _embedService)
 {
     tipService   = _tipService;
     embedService = _embedService;
 }
Exemplo n.º 11
0
 public void TestMethod2()
 {
     TipService.StatisticsAgentTipIncome(DateTime.Now.AddDays(-1), DateTime.Now);//前一天的收益数据
 }
Exemplo n.º 12
0
 public void TestMethod1()
 {
     TipService.StatisticsCollectTipGifts(DateTime.Now.AddDays(-7), 200);//第一次需要改redis中的时间 采集200条数据
 }
Exemplo n.º 13
0
        public void SetUp()
        {
            _tipRepository = Substitute.For <ITipRepository>();

            _sut = new TipService(_tipRepository);
        }
Exemplo n.º 14
0
        private TipService CreateNoUserService()
        {
            var service = new TipService();

            return(service);
        }
Exemplo n.º 15
0
 /// <summary>
 /// 按小时统计用户数据任务
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public Task Execute(IJobExecutionContext context)
 {
     TipService.StatisticsCollectTipGifts(DateTime.Now, 200);
     return(Task.FromResult(0));
 }
Exemplo n.º 16
0
 /// <summary>
 /// 按天统计代理的礼物收益
 /// </summary>
 /// <param name="context"></param>
 /// <returns></returns>
 public Task Execute(IJobExecutionContext context)
 {
     TipService.StatisticsAgentTipIncome(DateTime.Now.AddHours(-12), DateTime.Now);
     return(Task.FromResult(0));
 }
Exemplo n.º 17
0
        // GET: Tip/Details/5
        public ActionResult Details(int id)
        {
            TipService srv = new TipService();

            return(View(srv.Obter(id)));
        }
Exemplo n.º 18
0
        // GET: Tip
        public ActionResult Index()
        {
            TipService tip = new TipService();

            return(View(tip.Listar()));
        }