Esempio n. 1
0
        public void UpdateCredentialsTest()
        {
            string name = "Test Entry";
            NetworkCredential credentials = new NetworkCredential("Test", "User");

            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.SetCredentials(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<NativeMethods.RASCREDENTIALS>(), false)).Returns(true);

            bool result = target.UpdateCredentials(credentials);

            Assert.IsTrue(result);
        }
Esempio n. 2
0
        public void UpdateCredentialsInvalidOperationExceptionTest()
        {
            string name = "Test Entry";

            RasEntry target = new RasEntry(name);
            target.UpdateCredentials(new NetworkCredential("Test", "User"));
        }
Esempio n. 3
0
        public void UpdateCredentialsWithNullCredentialsArgumentNullExceptionTest()
        {
            string name = "Test Entry";

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

            target.UpdateCredentials(null);
        }
Esempio n. 4
0
        public void UpdateCredentials1NullCredentialsTest()
        {
            string name = "Test Entry";
            NetworkCredential credentials = null;

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

            target.UpdateCredentials(credentials, true);
        }
Esempio n. 5
0
        public void UpdateCredentials1NullOwnerTest()
        {
            string name = "Test Entry";
            NetworkCredential credentials = new NetworkCredential("Test", "User");

            RasEntry target = new RasEntry(name);
            target.UpdateCredentials(credentials, true);
        }
Esempio n. 6
0
        public void UpdateCredentials2ServerPreSharedKeyTest()
        {
            RasPhoneBook pbk = new RasPhoneBook();

            RasEntry target = new RasEntry("Test Entry");
            target.Owner = pbk;

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

            mock.Setup(o => o.SetCredentials(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<NativeMethods.RASCREDENTIALS>(), false)).Returns(true);

            bool result = target.UpdateCredentials(RasPreSharedKey.Server, "value");

            Assert.IsTrue(result);
        }