Exemplo n.º 1
0
        public ActionResult Create()
        {
            var user           = HttpContext.DiscussionUser();
            var chatySupported = _chatyApiService.IsChatySupported(user.UserName);
            var weChatAccount  = chatySupported ? _wechatAccountRepo.All().FirstOrDefault(wxa => wxa.UserId == user.Id) : null;

            return(View(weChatAccount != null));
        }
Exemplo n.º 2
0
        public void should_check_support_as_true_when_allowed_users_not_configured()
        {
            var optionsWithoutAllowedUsers = new Mock <IOptions <ChatyOptions> >();

            optionsWithoutAllowedUsers.SetupGet(op => op.Value).Returns(new ChatyOptions()
            {
                ServiceBaseUrl = "http://abcd",
                AllowedUsers   = null
            });

            var chatyApiService = new ChatyApiService(optionsWithoutAllowedUsers.Object, null, null);

            Assert.True(chatyApiService.IsChatySupported(StringUtility.Random(6)));
        }
Exemplo n.º 3
0
 public void should_check_support_as_false_when_user_not_in_list()
 {
     Assert.False(_normalChatyApiService.IsChatySupported("user_not_in_list"));
 }
Exemplo n.º 4
0
 public void should_check_support_as_false(ChatyApiService service)
 {
     Assert.False(service.IsChatySupported(_userAllowedToUseChaty));
 }