コード例 #1
0
        public async Task UpdateVaultStatus_AuthRequired_AuthPerformed()
        {
            // Arrange
            var logMock = new Mock <ILog>();

            var uiMock = new Mock <IClientUiManager>();

            var vaultMock = GetVaultMock(NEED_AUTH_ACCESSLEVEL);

            var hesAppConnectionMock = GetHesAppConnectionMock(HesConnectionState.Connected, vaultMock);

            var vaultAuthProcessor = new VaultAuthorizationProcessor(hesAppConnectionMock.Object, uiMock.Object, logMock.Object);

            // Act
            await vaultAuthProcessor.AuthVault(vaultMock.Object, CancellationToken.None);

            // Assert
        }
コード例 #2
0
        public async Task UpdateVaultStatus_AuthRequired_NoNetwork_ExceptionThrown()
        {
            // Arrange
            var logMock = new Mock <ILog>();

            var uiMock = new Mock <IClientUiManager>();

            var vaultMock = GetVaultMock(NEED_AUTH_ACCESSLEVEL);

            var hesAppConnectionMock = GetHesAppConnectionMock(HesConnectionState.Disconnected, vaultMock);

            var vaultAuthProcessor = new VaultAuthorizationProcessor(hesAppConnectionMock.Object, uiMock.Object, logMock.Object);

            // Act
            await vaultAuthProcessor.AuthVault(vaultMock.Object, CancellationToken.None);

            // Assert
            Assert.Fail("WorkflowException was expected");
        }
コード例 #3
0
        public async Task UpdateVaultStatus_AuthNotRequired_StatusUnchanged(HesConnectionState hesConnectionState)
        {
            // Arrange
            var logMock = new Mock <ILog>();

            var uiMock = new Mock <IClientUiManager>();

            var vaultMock = GetVaultMock(ALL_OK_ACCESSLEVEL);

            var hesAppConnectionMock = GetHesAppConnectionMock(hesConnectionState, vaultMock);

            hesAppConnectionMock
            .Setup(x => x.AuthHwVault(It.IsAny <string>()))
            .Throws(new InvalidOperationException("Unexpected request to server"));

            var vaultAuthProcessor = new VaultAuthorizationProcessor(hesAppConnectionMock.Object, uiMock.Object, logMock.Object);

            // Act
            await vaultAuthProcessor.AuthVault(vaultMock.Object, CancellationToken.None);

            // Assert
        }
コード例 #4
0
        public async Task UpdateVaultStatus_AuthRequired_HesAlgorithmError_ExceptionThrown()
        {
            // Arrange
            var logMock = new Mock <ILog>();

            var uiMock = new Mock <IClientUiManager>();

            var vaultMock = GetVaultMock(NEED_AUTH_ACCESSLEVEL);

            var hesAppConnectionMock = new Mock <IHesAppConnection>();

            hesAppConnectionMock.SetupGet(x => x.State).Returns(HesConnectionState.Connected);
            hesAppConnectionMock
            .Setup(x => x.AuthHwVault(It.IsAny <string>()))
            .Returns(Task.CompletedTask);

            var vaultAuthProcessor = new VaultAuthorizationProcessor(hesAppConnectionMock.Object, uiMock.Object, logMock.Object);

            // Act
            await vaultAuthProcessor.AuthVault(vaultMock.Object, CancellationToken.None);

            // Assert
            Assert.Fail("WorkflowException was expected");
        }