Skip to content

Commit

Permalink
Fixed unit tests related to #144 PR
Browse files Browse the repository at this point in the history
  • Loading branch information
gpailler committed Apr 25, 2020
1 parent 123eb30 commit 7c7edda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
8 changes: 5 additions & 3 deletions MegaApiClient.Tests/Login.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,12 @@ public void GenerateAuthInfos_InvalidCredentials_Throws(string email, string pas
Assert.Throws<ArgumentNullException>(expectedMessage, () => this.context.Client.GenerateAuthInfos(email, password));
}

[Theory, InlineData("[email protected]", "password", "{'Email':'[email protected]','Hash':'ObELy57HULI','PasswordAesKey':'ZAM5cl5uvROiXwBSEp98sQ=='}")]
public void GenerateAuthInfos_ValidCredentials_Succeeds(string email, string password, string expectedResult)
[Theory]
[InlineData("[email protected]", "password", null, "{'Email':'[email protected]','Hash':'ObELy57HULI','PasswordAesKey':'ZAM5cl5uvROiXwBSEp98sQ==','MFAKey':null}")]
[InlineData("[email protected]", "password", "mfa", "{'Email':'[email protected]','Hash':'ObELy57HULI','PasswordAesKey':'ZAM5cl5uvROiXwBSEp98sQ==','MFAKey':'mfa'}")]
public void GenerateAuthInfos_ValidCredentials_Succeeds(string email, string password, string mfa, string expectedResult)
{
var authInfos = this.context.Client.GenerateAuthInfos(email, password);
var authInfos = this.context.Client.GenerateAuthInfos(email, password, mfa);
var result = JsonConvert.SerializeObject(authInfos, Formatting.None).Replace('\"', '\'');

Assert.Equal(expectedResult, result);
Expand Down
9 changes: 1 addition & 8 deletions MegaApiClient/MegaApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,14 +1241,7 @@ private IEnumerable<int> ComputeChunksSizesToUpload(long[] chunksPositions, long

public class AuthInfos
{
public AuthInfos(string email, string hash, byte[] passwordAesKey)
{
this.Email = email;
this.Hash = hash;
this.PasswordAesKey = passwordAesKey;
}

public AuthInfos(string email, string hash, byte[] passwordAesKey, string mfaKey)
public AuthInfos(string email, string hash, byte[] passwordAesKey, string mfaKey = null)
{
this.Email = email;
this.Hash = hash;
Expand Down

0 comments on commit 7c7edda

Please sign in to comment.