Ejemplo n.º 1
0
        public void LogonProvider_DoLogon_ErrorThrowsMessage()
        {
            var mockLoginImpl = new Mock <ILoginApi>();

            var provider = new LogonProvider(mockLoginImpl.Object);
            var password = "******";

            var v = It.IsAny <SafeTokenHandle>();

            mockLoginImpl.Setup(o => o.LogonUser("IntegrationTester", "DEV2", password, 3, 3, out v))
            .Throws(new Exception("some exception"));


            var ioPath          = new Dev2ActivityIOPath(Interfaces.Enums.enActivityIOPathType.FileSystem, @"C:\", @"DEV2\IntegrationTester", password, false, null);
            var expectedMessage = string.Format(ErrorResource.FailedToAuthenticateUser, "IntegrationTester", ioPath.Path);

            var hadException = false;

            try
            {
                provider.DoLogon(ioPath);
            }
            catch (Exception e)
            {
                hadException = true;
                Assert.AreEqual(expectedMessage, e.Message);
            }
            Assert.IsTrue(hadException, "expected exception");

            mockLoginImpl.Verify(o => o.LogonUser("IntegrationTester", "DEV2", password, 3, 3, out v), Times.Once);
        }
Ejemplo n.º 2
0
        public void LogonProvider_Construct()
        {
            var provider = new LogonProvider();

            var ioPath = new Dev2ActivityIOPath(Interfaces.Enums.enActivityIOPathType.FileSystem, @"C:\", @".\LocalSchedulerAdmin", "987Sched#@!", false, null);

            provider.DoLogon(ioPath);
        }
Ejemplo n.º 3
0
        public void LogonProvider_DoLogon_LogonNetwork()
        {
            bool loginReturnStatus = true;

            var mockLoginImpl = new Mock <ILoginApi>();

            var provider = new LogonProvider(mockLoginImpl.Object);

            var username = @"dev2\IntegrationTester";
            var password = "******";

            var v = It.IsAny <SafeTokenHandle>();

            mockLoginImpl.Setup(o => o.LogonUser("IntegrationTester", "dev2", password, 3, 3, out v))
            .Returns(loginReturnStatus);


            var ioPath = new Dev2ActivityIOPath(Interfaces.Enums.enActivityIOPathType.FileSystem, @"C:\", username, password, false, null);

            provider.DoLogon(ioPath);

            mockLoginImpl.Verify(o => o.LogonUser("IntegrationTester", "dev2", password, 3, 3, out v), Times.Once);
        }