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)); }
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))); }
public void should_check_support_as_false_when_user_not_in_list() { Assert.False(_normalChatyApiService.IsChatySupported("user_not_in_list")); }
public void should_check_support_as_false(ChatyApiService service) { Assert.False(service.IsChatySupported(_userAllowedToUseChaty)); }