public MemberModels Login([FromBody] string value)
        {
            try
            {
                ICredentialsHelper credentialsHelper = new CredentialsHelper();
                IMemberRepository  memberRepository  = new MemberRepository();

                LoginModels postModel = new JavaScriptSerializer().Deserialize <LoginModels>(value);

                MemberModels member = new MemberModels();
                if (CacheHelper.MemberCache.Contains(postModel.Username))
                {
                    member             = (MemberModels)CacheHelper.MemberCache.Where(x => x.Key == postModel.Username).FirstOrDefault().Value;
                    member.LoginMethod = LoginMethodEnums.Cache.GetHashCode();
                }
                else
                {
                    member             = memberRepository.GetByUsername(postModel.Username);
                    member.LoginMethod = LoginMethodEnums.Database.GetHashCode();
                }

                return(credentialsHelper.AuthenticateMember(postModel, member));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(StaticKeyHelper.API, StaticKeyHelper.Login, ex.Message);
                return(null);
            }
        }
        public void CredentialsHelper_WrongUsernameMatchingPassword_Fails()
        {
            ICredentialsHelper credentialsHelper = new CredentialsHelper();

            LoginModels login = new LoginModels()
            {
                Username = "******",
                Password = "******"
            };

            MemberModels member = new MemberModels()
            {
                Username = "******",
                Password = "******"
            };

            Assert.IsNull(credentialsHelper.AuthenticateMember(login, member));
        }
        public void CredentialsHelper_MatchingUsernameWrongPassword_Fails()
        {
            ICredentialsHelper credentialsHelper = new CredentialsHelper();

            LoginModels login = new LoginModels()
            {
                Username = "******",
                Password = "******"
            };

            MemberModels member = new MemberModels()
            {
                Username = "******",
                Password = "******"
            };

            Assert.IsNull(credentialsHelper.AuthenticateMember(login, member));
        }