public void Credentials_ShouldContainClientIdentifier() { // Arrange _userStorage.User().Returns(_user); var sut = new VpnCredentialProvider(_appSettings, _userStorage); // Assert sut.Credentials().Username.Contains(_clientIdentifierSuffix).Should().BeTrue(); }
public void Credentials_Should_NotContainFSuffix_UsernameIfNetShieldIsDisabled() { // Arrange _userStorage.User().Returns(_user); _appSettings.NetShieldMode.Returns(2); _appSettings.NetShieldEnabled.Returns(false); var sut = new VpnCredentialProvider(_appSettings, _userStorage); // Assert _netShieldSuffixes.Any(s => s.Contains(sut.Credentials().Username)).Should().BeFalse(); }
public void Credentials_Should_NotModify_Username() { // Arrange _userStorage.User().Returns(_user); _appSettings.NetShieldMode.Returns(2); _appSettings.NetShieldEnabled.Returns(false); var sut = new VpnCredentialProvider(_appSettings, _userStorage, _vpnConfig); // Assert sut.Credentials().Username.Should().Be(_username); }
private async Task Connect(IEnumerable <Server> servers, VpnProtocol protocol) { var request = new VpnConnectionRequest( Servers(servers), protocol, VpnConfig(), _vpnCredentialProvider.Credentials()); await _vpnServiceManager.Connect(request); _logger.Info("Connect requested"); _modals.CloseAll(); }
public void Credentials_Should_Suffix_Username(int mode, string suffix) { // Arrange _userStorage.User().Returns(_user); _appSettings.NetShieldMode.Returns(mode); _appSettings.NetShieldEnabled.Returns(true); _vpnConfig.NetShieldEnabled.Returns(true); var sut = new VpnCredentialProvider(_appSettings, _userStorage, _vpnConfig); // Assert sut.Credentials().Username.Should().Be(_user.VpnUsername + suffix); }
public void Credentials_Should_Suffix_Username(int mode, string suffix) { // Arrange _userStorage.User().Returns(_user); _appSettings.NetShieldMode.Returns(mode); _appSettings.IsNetShieldEnabled().Returns(true); var sut = new VpnCredentialProvider(_config, _appSettings, _userStorage); // Assert sut.Credentials().Username.Replace(_username, string.Empty) .Contains(suffix) .Should() .BeTrue(); }
public void Credentials_Should_Suffix_Username(int mode, string suffix) { // Arrange var user = new User { VpnUsername = "******", VpnPassword = "******" }; _userStorage.User().Returns(user); _appSettings.NetShieldMode.Returns(mode); _appSettings.NetShieldEnabled.Returns(true); var sut = new VpnCredentialProvider(_appSettings, _userStorage); // Assert sut.Credentials().Username.Should().Be(user.VpnUsername + suffix); }
public void Credentials_Should_NotModify_Username() { // Arrange var username = "******"; var user = new User { VpnUsername = username, VpnPassword = "******" }; _userStorage.User().Returns(user); _appSettings.NetShieldMode.Returns(2); _appSettings.NetShieldEnabled.Returns(false); var sut = new VpnCredentialProvider(_appSettings, _userStorage); // Assert sut.Credentials().Username.Should().Be(username); }