public void CanChangeLoginName()
        {
            // Arrange (set up a scenario)
            Member bob = new Member() { LoginName = "Bob" };
            FakeMembersRepository repositoryParam = new FakeMembersRepository();
            repositoryParam.Members.Add(bob);
            AdminController target = new AdminController(repositoryParam);
            string oldLoginParam = bob.LoginName;
            string newLoginParam = "Anastasia";

            // Act (attempt the operation)
            target.ChangeLoginName(oldLoginParam, newLoginParam);

            // Assert (verify the result)
            Assert.AreEqual(newLoginParam, bob.LoginName);
            Assert.IsTrue(repositoryParam.DidSubmitChanges);
        }
Exemple #2
0
        public void CanChangeLoginName()
        {
            // Arrange (устанавливается сценарий)
            Member bob = new Member()
            {
                LoginName = "Bob"
            };
            FakeMembersRepository repositoryParam = new FakeMembersRepository();

            repositoryParam.Members.Add(bob);
            AdminController target        = new AdminController(repositoryParam);
            string          oldLoginParam = bob.LoginName;
            string          newLoginParam = "Anastasia";

            // Act (проводится операция)
            target.ChangeLoginName(oldLoginParam, newLoginParam);
            // Assert (проверяется результат)
            Assert.AreEqual(newLoginParam, bob.LoginName);
            Assert.IsTrue(repositoryParam.DidSubmitChanges);
        }
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        // [TestMethod()]
        public void ChangeLoginNameTest()
        {
            // Arrange (set up a scenario)
            Member bob = new Member()
            {
                LoginName = "Bob"
            };
            FakeMembersRepository repositoryParam = new FakeMembersRepository();

            repositoryParam.Members.Add(bob);
            AdminController target        = new AdminController(repositoryParam);
            string          oldLoginParam = bob.LoginName;
            string          newLoginParam = "Anastasia";

            // Act (attempt the operation)
            target.ChangeLoginName(oldLoginParam, newLoginParam);

            // Assert (verify the result)
            Assert.AreEqual(newLoginParam, bob.LoginName);
            Assert.IsTrue(repositoryParam.DidSubmitChanges);
        }
Exemple #4
0
        public void CanChangeLoginName()
        {
            //Arrange
            Member Bob = new Member()
            {
                LoginName = "Bod"
            };
            FakeMembersRepository repositoryParam = new FakeMembersRepository();

            repositoryParam.Members.Add(Bob);
            AdminController target        = new AdminController(repositoryParam);
            string          oldLoginParam = Bob.LoginName;
            string          newLoginParam = "Tom";

            //Act
            target.ChangeLoginName(oldLoginParam, newLoginParam);

            //Assert
            Assert.AreEqual(newLoginParam, Bob.LoginName);
            Assert.IsTrue(repositoryParam.DidSubmitChanges);
        }