コード例 #1
0
ファイル: AccountTests.cs プロジェクト: tehnumberone/Stranded
        public void TestRegister()
        {
            //Arrange
            RegisterViewModel rvm = new RegisterViewModel()
            {
                Username = "******",
                Password = "******",
                Email    = "*****@*****.**"
            };
            bool    accountiscreated = false;
            Account acc = new Account(rvm.Username, rvm.Password, rvm.Email);

            IAccountContext _Iac = new TestAccountContext();
            AccountRepo     _ar  = new AccountRepo(_Iac);

            //Act
            if (rvm.Username != null && rvm.Password != null && rvm.Email != null)
            {
                _ar.Create(acc);
                accountiscreated = true;
            }
            //Assert
            Assert.IsTrue(accountiscreated);
        }
コード例 #2
0
ファイル: AccountTests.cs プロジェクト: tehnumberone/Stranded
        public void TestLogin()
        {
            //Arrange
            LoginViewModel lvm = new LoginViewModel()
            {
                Username = "******",
                Password = "******"
            };
            bool loggedin = false;

            IAccountContext _Iac = new TestAccountContext();
            AccountRepo     _ar  = new AccountRepo(_Iac);

            //Act
            if (lvm.Username != "" && lvm.Password != "")
            {
                if (_ar.CheckAccount(lvm.Username, lvm.Password))
                {
                    loggedin = true;
                }
            }
            //Assert
            Assert.IsTrue(loggedin);
        }