Skip to content

Commit

Permalink
Update tests to check for AccessToken instead of deprecated LoginKey
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Jun 5, 2023
1 parent 051797b commit e4ad6a1
Showing 1 changed file with 5 additions and 44 deletions.
49 changes: 5 additions & 44 deletions SteamKit2/Tests/SteamUserFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,19 @@ public void LogOnThrowsExceptionIfUsernameNotProvided_OnlyPassword()
}

[Fact]
public void LogOnThrowsExceptionIfUsernameNotProvided_OnlyLoginKey()
public void LogOnThrowsExceptionIfUsernameNotProvided_OnlyAccessToken()
{
Assert.Throws<ArgumentException>(() =>
{
Handler.LogOn(new SteamUser.LogOnDetails
{
LoginKey = "def"
AccessToken = "def"
});
});
}

[Fact]
public void LogOnThrowsExceptionIfUsernameNotProvided_OnlyLoginKey_ShouldRememberPassword()
{
Assert.Throws<ArgumentException>(() =>
{
Handler.LogOn(new SteamUser.LogOnDetails
{
LoginKey = "def",
ShouldRememberPassword = true
});
});
}

[Fact]
public void LogOnThrowsExceptionIfPasswordAndLoginKeyNotProvided()
public void LogOnThrowsExceptionIfPasswordAndAccessTokenNotProvided()
{
Assert.Throws<ArgumentException>(() =>
{
Expand All @@ -81,19 +68,6 @@ public void LogOnThrowsExceptionIfPasswordAndLoginKeyNotProvided()
});
}

[Fact]
public void LogOnThrowsExceptionIfLoginKeyProvidedWithoutShouldRememberPassword()
{
Assert.Throws<ArgumentException>(() =>
{
Handler.LogOn(new SteamUser.LogOnDetails
{
Username = "abc",
LoginKey = "def"
});
});
}

[Fact]
public void LogOnDoesNotThrowExceptionIfUserNameAndPasswordProvided()
{
Expand All @@ -110,34 +84,21 @@ public void LogOnDoesNotThrowExceptionIfUserNameAndPasswordProvided()
}

[Fact]
public void LogOnDoesNotThrowExceptionIfUserNameAndLoginKeyProvided()
public void LogOnDoesNotThrowExceptionIfUserNameAndAccessTokenProvided()
{
var ex = Record.Exception(() =>
{
Handler.LogOn(new SteamUser.LogOnDetails
{
Username = "abc",
LoginKey = "def",
AccessToken = "def",
ShouldRememberPassword = true,
});
});

Assert.Null( ex );
}

[Fact]
public void LogOnThrowsExceptionIfLoginKeyIsProvidedWithoutShouldRememberPassword()
{
Assert.Throws<ArgumentException>(() =>
{
Handler.LogOn(new SteamUser.LogOnDetails
{
Username = "abc",
LoginKey = "def"
});
});
}

[Fact]
public void LogOnAnonymousPostsLoggedOnCallbackWhenNoConnection()
{
Expand Down

0 comments on commit e4ad6a1

Please sign in to comment.