Esempio n. 1
0
        public void RenameInvalidEntryNameTest()
        {
            string name = "Test Entry";
            string newEntryName = ".\\Test*!";
            RasPhoneBook pbk = new RasPhoneBook();

            RasEntry target = new RasEntry(name);
            target.Owner = pbk;

            Mock<IRasHelper> mock = new Mock<IRasHelper>();
            RasHelper.Instance = mock.Object;

            mock.Setup(o => o.IsValidEntryName(pbk, newEntryName)).Returns(false);

            target.Rename(newEntryName);
        }
Esempio n. 2
0
        public void RenameEmptyEntryNameExceptionTest()
        {
            string name = "Test Entry";
            string newEntryName = string.Empty;

            RasEntry target = new RasEntry(name);
            target.Rename(newEntryName);
        }
Esempio n. 3
0
        public void RenameEntryNotInPhoneBookTest()
        {
            string name = "Test Entry";
            string newEntryName = "New Entry";
            bool expected = true;

            RasEntry target = new RasEntry(name);
            bool actual = target.Rename(newEntryName);

            Assert.AreEqual(expected, actual);
            Assert.AreEqual(newEntryName, target.Name);
        }
Esempio n. 4
0
        public void RenameNullEntryNameExceptionTest()
        {
            string name = "Test Entry";
            string newEntryName = null;

            RasEntry target = new RasEntry(name);
            target.Rename(newEntryName);
        }