示例#1
0
        public void GenerateOtpOk_Test()
        {
            string dummyPhNumber   = string.Empty;
            var    AadharCarddummy = new AadharCard()
            {
                AadharNumber = 654345678912,
                FirstName    = "vijendra",
                LastName     = "AadharLName_Dummy",
                Dob          = "19-04-1991",
                PhoneNumber  = "+919885801218",
                Address      = "Dummy_Address",
                State        = "Dummy_State",
                Pincode      = 500083,
                Gender       = "Male"
            };
            var Voter = new Voter()
            {
                Aadharnumber          = 678567432876,
                FName                 = "vijendra",
                Registrationfromstate = "Dummy_state",
                VoterID               = 7867677,
                Voted                 = false
            };

            RepoMock.Setup(r => r.GenerateOtp(678567432876)).Returns(AadharCarddummy.PhoneNumber);
            RegisterController Controller = new RegisterController(RepoMock.Object);
            var result   = Controller.GenerateOTP(Voter.Aadharnumber);
            var okResult = result as ObjectResult;

            Assert.True(okResult is ObjectResult);
            Assert.NotEqual(dummyPhNumber, okResult.Value);
            Assert.Equal(StatusCodes.Status200OK, okResult.StatusCode);
        }