2016-09-06 17:37:05 +02:00
|
|
|
|
using System.Configuration;
|
|
|
|
|
|
using System.Diagnostics;
|
2016-02-03 20:36:39 +01:00
|
|
|
|
using System.IO;
|
2015-09-28 04:01:17 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
|
using TLSharp.Core;
|
|
|
|
|
|
using TLSharp.Core.Auth;
|
2016-02-03 20:36:39 +01:00
|
|
|
|
using TLSharp.Core.MTProto;
|
2015-09-28 04:01:17 +02:00
|
|
|
|
using TLSharp.Core.Network;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TLSharp.Tests
|
|
|
|
|
|
{
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestClass]
|
|
|
|
|
|
public class TLSharpTests
|
|
|
|
|
|
{
|
|
|
|
|
|
private string NumberToSendMessage { get; set; }
|
2016-01-27 12:02:18 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
private string NumberToAuthenticate { get; set; }
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-09-06 17:37:05 +02:00
|
|
|
|
private string NotRegisteredNumberToSignUp { get; set; }
|
|
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
private string UserNameToSendMessage { get; set; }
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-05-18 12:55:22 +02:00
|
|
|
|
private string NumberToGetUserFull { get; set; }
|
|
|
|
|
|
|
2016-04-18 13:05:30 +02:00
|
|
|
|
private string apiHash = "";
|
|
|
|
|
|
|
|
|
|
|
|
private int apiId = 0;
|
|
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestInitialize]
|
|
|
|
|
|
public void Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Setup your phone numbers in app.config
|
2016-09-06 17:37:05 +02:00
|
|
|
|
NumberToAuthenticate = ConfigurationManager.AppSettings[nameof(NumberToAuthenticate)];
|
2016-04-18 12:50:57 +02:00
|
|
|
|
if (string.IsNullOrEmpty(NumberToAuthenticate))
|
2016-09-06 17:37:05 +02:00
|
|
|
|
Debug.WriteLine("NumberToAuthenticate not configured in app.config! Some tests may fail.");
|
|
|
|
|
|
|
|
|
|
|
|
NotRegisteredNumberToSignUp = ConfigurationManager.AppSettings[nameof(NotRegisteredNumberToSignUp)];
|
|
|
|
|
|
if (string.IsNullOrEmpty(NotRegisteredNumberToSignUp))
|
|
|
|
|
|
Debug.WriteLine("NotRegisteredNumberToSignUp not configured in app.config! Some tests may fail.");
|
2015-10-01 14:55:02 +02:00
|
|
|
|
|
2016-09-06 17:37:05 +02:00
|
|
|
|
NumberToSendMessage = ConfigurationManager.AppSettings[nameof(NumberToSendMessage)];
|
2016-04-18 12:50:57 +02:00
|
|
|
|
if (string.IsNullOrEmpty(NumberToSendMessage))
|
2016-09-06 17:37:05 +02:00
|
|
|
|
Debug.WriteLine("NumberToSendMessage not configured in app.config! Some tests may fail.");
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-09-06 17:37:05 +02:00
|
|
|
|
UserNameToSendMessage = ConfigurationManager.AppSettings[nameof(UserNameToSendMessage)];
|
2016-04-18 12:50:57 +02:00
|
|
|
|
if (string.IsNullOrEmpty(UserNameToSendMessage))
|
2016-09-06 17:37:05 +02:00
|
|
|
|
Debug.WriteLine("UserNameToSendMessage not configured in app.config! Some tests may fail.");
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-09-06 17:37:05 +02:00
|
|
|
|
NumberToGetUserFull = ConfigurationManager.AppSettings[nameof(NumberToGetUserFull)];
|
2016-05-18 12:55:22 +02:00
|
|
|
|
if (string.IsNullOrEmpty(NumberToGetUserFull))
|
2016-09-06 17:37:05 +02:00
|
|
|
|
Debug.WriteLine("NumberToGetUserFull not configured in app.config! Some tests may fail.");
|
2016-05-18 12:55:22 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task AuthUser()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2015-10-01 14:55:02 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var hash = await client.SendCodeRequest(NumberToAuthenticate);
|
|
|
|
|
|
var code = "93463"; // you can change code in debugger
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var user = await client.MakeAuth(NumberToAuthenticate, hash, code);
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(user);
|
2016-09-06 17:37:05 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task SignUpNewUser()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
|
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
|
|
|
|
|
await client.Connect();
|
|
|
|
|
|
|
|
|
|
|
|
var hash = await client.SendCodeRequest(NotRegisteredNumberToSignUp);
|
|
|
|
|
|
var code = "";
|
|
|
|
|
|
|
|
|
|
|
|
var registeredUser = await client.SignUp(NotRegisteredNumberToSignUp, hash, code, "TLSharp", "User");
|
|
|
|
|
|
Assert.IsNotNull(registeredUser);
|
|
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
|
|
|
|
|
|
|
|
|
|
|
var loggedInUser = await client.MakeAuth(NotRegisteredNumberToSignUp, hash, code);
|
|
|
|
|
|
Assert.IsNotNull(loggedInUser);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task CheckPhones()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var result = await client.IsPhoneRegistered(NumberToAuthenticate);
|
|
|
|
|
|
Assert.IsTrue(result);
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task ImportContactByPhoneNumber()
|
|
|
|
|
|
{
|
|
|
|
|
|
// User should be already authenticated!
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(res);
|
|
|
|
|
|
}
|
2016-02-01 21:39:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task ImportByUserName()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2016-02-01 21:39:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2016-02-01 21:39:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var res = await client.ImportByUserName(UserNameToSendMessage);
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(res);
|
|
|
|
|
|
}
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task ImportByUserNameAndSendMessage()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
2016-02-01 21:39:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var res = await client.ImportByUserName(UserNameToSendMessage);
|
2016-02-01 21:58:51 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(res);
|
2016-02-01 21:39:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.SendMessage(res.Value, "Test message from TelegramClient");
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task ImportContactByPhoneNumberAndSendMessage()
|
|
|
|
|
|
{
|
|
|
|
|
|
// User should be already authenticated!
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(res);
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.SendMessage(res.Value, "Test message from TelegramClient");
|
|
|
|
|
|
}
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task GetHistory()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(res);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var hist = await client.GetMessagesHistoryForContact(res.Value, 0, 5);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(hist);
|
|
|
|
|
|
}
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task UploadAndSendMedia()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
await client.Connect();
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(res);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var file = File.ReadAllBytes("../../data/cat.jpg");
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var mediaFile = await client.UploadFile("test_file.jpg", file);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsNotNull(mediaFile);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
var state = await client.SendMediaMessage(res.Value, mediaFile);
|
2016-02-03 20:36:39 +01:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(state);
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-05-17 14:22:14 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task GetFile()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Get uploaded file from last message (ie: cat.jpg)
|
|
|
|
|
|
|
|
|
|
|
|
var store = new FileSessionStore();
|
|
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
|
|
|
|
|
await client.Connect();
|
|
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
|
|
|
|
|
|
|
|
|
|
|
var res = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
|
|
|
|
|
Assert.IsNotNull(res);
|
|
|
|
|
|
|
|
|
|
|
|
// Get last message
|
|
|
|
|
|
var hist = await client.GetMessagesHistoryForContact(res.Value, 0, 1);
|
|
|
|
|
|
Assert.AreEqual(1, hist.Count);
|
|
|
|
|
|
|
|
|
|
|
|
var message = (MessageConstructor) hist[0];
|
|
|
|
|
|
Assert.AreEqual(typeof(MessageMediaPhotoConstructor), message.media.GetType());
|
|
|
|
|
|
|
|
|
|
|
|
var media = (MessageMediaPhotoConstructor) message.media;
|
|
|
|
|
|
Assert.AreEqual(typeof(PhotoConstructor), media.photo.GetType());
|
|
|
|
|
|
|
|
|
|
|
|
var photo = (PhotoConstructor) media.photo;
|
|
|
|
|
|
Assert.AreEqual(3, photo.sizes.Count);
|
|
|
|
|
|
Assert.AreEqual(typeof(PhotoSizeConstructor), photo.sizes[2].GetType());
|
|
|
|
|
|
|
|
|
|
|
|
var photoSize = (PhotoSizeConstructor) photo.sizes[2];
|
|
|
|
|
|
Assert.AreEqual(typeof(FileLocationConstructor), photoSize.location.GetType());
|
|
|
|
|
|
|
|
|
|
|
|
var fileLocation = (FileLocationConstructor) photoSize.location;
|
|
|
|
|
|
var file = await client.GetFile(fileLocation.volume_id, fileLocation.local_id, fileLocation.secret, 0, photoSize.size + 1024);
|
|
|
|
|
|
storage_FileType type = file.Item1;
|
|
|
|
|
|
byte[] bytes = file.Item2;
|
|
|
|
|
|
|
|
|
|
|
|
string name = "../../data/get_file.";
|
|
|
|
|
|
if (type.GetType() == typeof(Storage_fileJpegConstructor))
|
|
|
|
|
|
name += "jpg";
|
|
|
|
|
|
else if (type.GetType() == typeof(Storage_fileGifConstructor))
|
|
|
|
|
|
name += "gif";
|
|
|
|
|
|
else if (type.GetType() == typeof(Storage_filePngConstructor))
|
|
|
|
|
|
name += "png";
|
|
|
|
|
|
|
|
|
|
|
|
using (var fileStream = new FileStream(name, FileMode.Create, FileAccess.Write))
|
|
|
|
|
|
{
|
|
|
|
|
|
fileStream.Write(bytes, 4, photoSize.size); // The first 4 bytes seem to be the error code
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task TestConnection()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FakeSessionStore();
|
2016-04-21 13:00:40 +02:00
|
|
|
|
var client = new TelegramClient(store, "", apiId, apiHash);
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
Assert.IsTrue(await client.Connect());
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task AuthenticationWorks()
|
|
|
|
|
|
{
|
|
|
|
|
|
using (var transport = new TcpTransport("91.108.56.165", 443))
|
|
|
|
|
|
{
|
|
|
|
|
|
var authKey = await Authenticator.DoAuthentication(transport);
|
|
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(authKey.AuthKey.Data);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-05-18 12:55:22 +02:00
|
|
|
|
|
|
|
|
|
|
[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);
|
|
|
|
|
|
}
|
2016-09-13 12:34:32 +02:00
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
|
public async Task GetUpdates()
|
|
|
|
|
|
{
|
|
|
|
|
|
var store = new FileSessionStore();
|
|
|
|
|
|
var client = new TelegramClient(store, "session", apiId, apiHash);
|
|
|
|
|
|
await client.Connect();
|
|
|
|
|
|
|
|
|
|
|
|
Assert.IsTrue(client.IsUserAuthorized());
|
|
|
|
|
|
|
|
|
|
|
|
var updatesState = await client.GetUpdatesState();
|
|
|
|
|
|
var initialState = updatesState as Updates_stateConstructor;
|
|
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(initialState);
|
|
|
|
|
|
|
|
|
|
|
|
var difference = await client.GetUpdatesDifference(initialState.pts, initialState.date, initialState.qts);
|
|
|
|
|
|
Assert.IsNotNull(difference);
|
|
|
|
|
|
Assert.AreEqual(difference.Constructor, Constructor.updates_differenceEmpty);
|
|
|
|
|
|
|
|
|
|
|
|
var userIdToSendMessage = await client.ImportContactByPhoneNumber(NumberToSendMessage);
|
|
|
|
|
|
|
|
|
|
|
|
await client.SendMessage(userIdToSendMessage.Value, "test");
|
|
|
|
|
|
|
|
|
|
|
|
var differenceAfterMessage = await client.GetUpdatesDifference(initialState.pts, initialState.date, initialState.qts);
|
|
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(differenceAfterMessage);
|
|
|
|
|
|
Assert.AreEqual(differenceAfterMessage.Constructor, Constructor.updates_difference);
|
|
|
|
|
|
|
|
|
|
|
|
var differenceUpdate = differenceAfterMessage as Updates_differenceConstructor;
|
|
|
|
|
|
Assert.IsNotNull(differenceUpdate);
|
|
|
|
|
|
Assert.AreEqual(1, differenceUpdate.new_messages.Count);
|
|
|
|
|
|
|
|
|
|
|
|
var messageUpdate = differenceUpdate.new_messages[0] as MessageConstructor;
|
|
|
|
|
|
Assert.IsNotNull(messageUpdate);
|
|
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual("test", messageUpdate.message);
|
|
|
|
|
|
}
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
}
|