mirror of
https://github.com/sochix/TLSharp.git
synced 2026-04-05 14:37:04 +00:00
UserFullConstructor : UserFull no accepts self id.
Added test method to GetUserFull Added info to README.md
This commit is contained in:
parent
2fff2d11c2
commit
6365297aaf
7 changed files with 98 additions and 3 deletions
|
|
@ -19,6 +19,8 @@ namespace TLSharp.Tests
|
|||
|
||||
private string UserNameToSendMessage { get; set; }
|
||||
|
||||
private string NumberToGetUserFull { get; set; }
|
||||
|
||||
private string apiHash = "";
|
||||
|
||||
private int apiId = 0;
|
||||
|
|
@ -39,6 +41,10 @@ namespace TLSharp.Tests
|
|||
if (string.IsNullOrEmpty(UserNameToSendMessage))
|
||||
throw new InvalidOperationException("UserNameToSendMessage is null. Specify userName in app.config");
|
||||
|
||||
NumberToGetUserFull = ConfigurationManager.AppSettings["numberToGetUserFull"];
|
||||
if (string.IsNullOrEmpty(NumberToGetUserFull))
|
||||
throw new InvalidOperationException("NumberToGetUserFull is null. Specify Number in app.config");
|
||||
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
@ -197,5 +203,23 @@ namespace TLSharp.Tests
|
|||
Assert.IsNotNull(authKey.AuthKey.Data);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task GetUserFullRequest()
|
||||
{
|
||||
var store = new FileSessionStore();
|
||||
var client = new TelegramClient(store, "session", apiId, apiHash);
|
||||
await client.Connect();
|
||||
|
||||
Assert.IsTrue(client.IsUserAuthorized());
|
||||
|
||||
var res = await client.ImportContactByPhoneNumber(NumberToGetUserFull);
|
||||
|
||||
Assert.IsNotNull(res);
|
||||
|
||||
var userFull = await client.GetUserFull(res.Value);
|
||||
|
||||
Assert.IsNotNull(userFull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@
|
|||
<add key="numberToAuthenticate" value="" />
|
||||
<add key="numberToSendMessage" value=""/>
|
||||
<add key="userNameToSendMessage" value=""/>
|
||||
<add key="NumberToGetUserFull" value=""/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue