diff --git a/TLSharp.Tests/Properties/AssemblyInfo.cs b/TLSharp.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 706d0a4..0000000
--- a/TLSharp.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("TLSharp.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("TLSharp.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("de5c0467-ee99-4734-95f2-eff7a0b99924")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/TLSharp.Tests/TLSharp.Tests.csproj b/TLSharp.Tests/TLSharp.Tests.csproj
deleted file mode 100644
index a2463ad..0000000
--- a/TLSharp.Tests/TLSharp.Tests.csproj
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
- Debug
- AnyCPU
- {DE5C0467-EE99-4734-95F2-EFF7A0B99924}
- Library
- Properties
- TLSharp.Tests
- TLSharp.Tests
- v4.5.2
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {400d2544-1cc6-4d8a-a62c-2292d9947a16}
- TLSharp.Core
-
-
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/TLSharp.Tests/TLSharpTests.cs b/TLSharp.Tests/TLSharpTests.cs
deleted file mode 100644
index d5ed580..0000000
--- a/TLSharp.Tests/TLSharpTests.cs
+++ /dev/null
@@ -1,423 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using TLSharp.Core;
-using TLSharp.Core.Auth;
-using TLSharp.Core.MTProto;
-using TLSharp.Core.Network;
-
-namespace TLSharp.Tests
-{
- [TestClass]
- public class TLSharpTests
- {
- private string NumberToSendMessage { get; set; }
-
- private string NumberToAuthenticate { get; set; }
-
- private string NotRegisteredNumberToSignUp { get; set; }
-
- private string UserNameToSendMessage { get; set; }
-
- private string NumberToGetUserFull { get; set; }
-
- private string NumberToAddToChat { get; set; }
-
- private string apiHash = "";
-
- private int apiId = 0;
-
- [TestInitialize]
- public void Init()
- {
- // Setup your phone numbers in app.config
- NumberToAuthenticate = ConfigurationManager.AppSettings[nameof(NumberToAuthenticate)];
- if (string.IsNullOrEmpty(NumberToAuthenticate))
- 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.");
-
- NumberToSendMessage = ConfigurationManager.AppSettings[nameof(NumberToSendMessage)];
- if (string.IsNullOrEmpty(NumberToSendMessage))
- Debug.WriteLine("NumberToSendMessage not configured in app.config! Some tests may fail.");
-
- UserNameToSendMessage = ConfigurationManager.AppSettings[nameof(UserNameToSendMessage)];
- if (string.IsNullOrEmpty(UserNameToSendMessage))
- Debug.WriteLine("UserNameToSendMessage not configured in app.config! Some tests may fail.");
-
- NumberToGetUserFull = ConfigurationManager.AppSettings[nameof(NumberToGetUserFull)];
- if (string.IsNullOrEmpty(NumberToGetUserFull))
- Debug.WriteLine("NumberToGetUserFull not configured in app.config! Some tests may fail.");
-
- NumberToAddToChat = ConfigurationManager.AppSettings[nameof(NumberToAddToChat)];
- if (string.IsNullOrEmpty(NumberToAddToChat))
- Debug.WriteLine("NumberToAddToChat not configured in app.config! Some tests may fail.");
- }
-
- [TestMethod]
- public async Task AuthUser()
- {
- var store = new FileSessionStore();
- var client = new TelegramClient(store, "session", apiId, apiHash);
-
- await client.Connect();
-
- var hash = await client.SendCodeRequest(NumberToAuthenticate);
- var code = "93463"; // you can change code in debugger
-
- var user = await client.MakeAuth(NumberToAuthenticate, hash, code);
-
- Assert.IsNotNull(user);
- 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);
- }
-
- [TestMethod]
- public async Task CheckPhones()
- {
- var store = new FileSessionStore();
- var client = new TelegramClient(store, "session", apiId, apiHash);
- await client.Connect();
-
- var result = await client.IsPhoneRegistered(NumberToAuthenticate);
- Assert.IsTrue(result);
- }
-
- [TestMethod]
- public async Task ImportContactByPhoneNumber()
- {
- // User should be already authenticated!
-
- 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);
- }
-
- [TestMethod]
- public async Task ImportByUserName()
- {
- var store = new FileSessionStore();
- var client = new TelegramClient(store, "session", apiId, apiHash);
-
- await client.Connect();
-
- Assert.IsTrue(client.IsUserAuthorized());
-
- var res = await client.ImportByUserName(UserNameToSendMessage);
-
- Assert.IsNotNull(res);
- }
-
- [TestMethod]
- public async Task ImportByUserNameAndSendMessage()
- {
- var store = new FileSessionStore();
- var client = new TelegramClient(store, "session", apiId, apiHash);
-
- await client.Connect();
-
- Assert.IsTrue(client.IsUserAuthorized());
-
- var res = await client.ImportByUserName(UserNameToSendMessage);
-
- Assert.IsNotNull(res);
-
- await client.SendMessage(res.Value, "Test message from TelegramClient");
- }
-
- [TestMethod]
- public async Task ImportContactByPhoneNumberAndSendMessage()
- {
- // User should be already authenticated!
-
- 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);
-
- await client.SendMessage(res.Value, "Test message from TelegramClient");
- }
-
- [TestMethod]
- public async Task GetHistory()
- {
- 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);
-
- var hist = await client.GetMessagesHistoryForContact(res.Value, 0, 5);
-
- Assert.IsNotNull(hist);
- }
-
- [TestMethod]
- public async Task UploadAndSendMedia()
- {
- 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);
-
- var file = File.ReadAllBytes("../../data/cat.jpg");
-
- var mediaFile = await client.UploadFile("test_file.jpg", file);
-
- Assert.IsNotNull(mediaFile);
-
- var state = await client.SendMediaMessage(res.Value, mediaFile);
-
- Assert.IsTrue(state);
- }
-
- [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
- }
- }
-
- [TestMethod]
- public async Task TestConnection()
- {
- var store = new FakeSessionStore();
- var client = new TelegramClient(store, "", apiId, apiHash);
-
- Assert.IsTrue(await client.Connect());
- }
-
- [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);
- }
- }
-
- [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);
- }
-
- [TestMethod]
- public async Task CreateChatRequest()
- {
- var client = await InitializeClient();
-
- var chatName = Guid.NewGuid().ToString();
- var statedMessage = await client.CreateChat(chatName, new List {NumberToSendMessage});
-
- var createdChat = GetChatFromStatedMessage(statedMessage);
-
- Assert.AreEqual(chatName, createdChat.title);
- Assert.AreEqual(2, createdChat.participants_count);
- }
-
- [TestMethod]
- public async Task AddChatUserRequest()
- {
- var client = await InitializeClient();
-
- var chatName = Guid.NewGuid().ToString();
- var statedMessageAfterCreation = await client.CreateChat(chatName, new List { NumberToSendMessage });
-
- var createdChat = GetChatFromStatedMessage(statedMessageAfterCreation);
-
- var addUserId = await client.ImportContactByPhoneNumber(NumberToAddToChat);
-
- var statedMessageAfterAddUser = await client.AddChatUser(createdChat.id, addUserId.Value);
- var modifiedChat = GetChatFromStatedMessage(statedMessageAfterAddUser);
-
- Assert.AreEqual(createdChat.id, modifiedChat.id);
- Assert.AreEqual(3, modifiedChat.participants_count);
- }
-
- [TestMethod]
- public async Task LeaveChatRequest()
- {
- var client = await InitializeClient();
-
- var chatName = Guid.NewGuid().ToString();
- var statedMessageAfterCreation = await client.CreateChat(chatName, new List { NumberToSendMessage });
-
- var createdChat = GetChatFromStatedMessage(statedMessageAfterCreation);
-
- var statedMessageAfterLeave = await client.LeaveChat(createdChat.id);
- var modifiedChat = GetChatFromStatedMessage(statedMessageAfterLeave);
-
- Assert.AreEqual(createdChat.id, modifiedChat.id);
- Assert.AreEqual(1, modifiedChat.participants_count);
- }
-
- private ChatConstructor GetChatFromStatedMessage(Messages_statedMessageConstructor message)
- {
- var serviceMessage = message.message as MessageServiceConstructor;
- var peerChat = serviceMessage.to_id as PeerChatConstructor;
-
- var createdChatId = peerChat.chat_id;
- return message.chats.OfType().Single(c => c.id == createdChatId);
- }
-
- private async Task InitializeClient()
- {
- var store = new FileSessionStore();
- var client = new TelegramClient(store, "session", apiId, apiHash);
- await client.Connect();
-
- if (!client.IsUserAuthorized())
- {
- var hash = await client.SendCodeRequest(NumberToAuthenticate);
-
- var code = ""; // you can change code in debugger
- Debugger.Break();
-
- await client.MakeAuth(NumberToAuthenticate, hash, code);
- }
-
- Assert.IsTrue(client.IsUserAuthorized());
-
- return client;
- }
-
- [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);
- }
- }
-}
diff --git a/TLSharp.Tests/app.config b/TLSharp.Tests/app.config
deleted file mode 100644
index 62aae65..0000000
--- a/TLSharp.Tests/app.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/TLSharp.Tests/data/cat.jpg b/TLSharp.Tests/data/cat.jpg
deleted file mode 100644
index f64b383..0000000
Binary files a/TLSharp.Tests/data/cat.jpg and /dev/null differ
diff --git a/TLSharp.Tests/packages.config b/TLSharp.Tests/packages.config
deleted file mode 100644
index 6b8deb9..0000000
--- a/TLSharp.Tests/packages.config
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/TLSharp.sln b/TLSharp.sln
index d9ec695..1d8702f 100644
--- a/TLSharp.sln
+++ b/TLSharp.sln
@@ -1,12 +1,10 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
-VisualStudioVersion = 14.0.23107.0
+VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Core", "TLSharp.Core\TLSharp.Core.csproj", "{400D2544-1CC6-4D8A-A62C-2292D9947A16}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TLSharp.Tests", "TLSharp.Tests\TLSharp.Tests.csproj", "{DE5C0467-EE99-4734-95F2-EFF7A0B99924}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -17,10 +15,6 @@ Global
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Debug|Any CPU.Build.0 = Debug|Any CPU
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Release|Any CPU.ActiveCfg = Release|Any CPU
{400D2544-1CC6-4D8A-A62C-2292D9947A16}.Release|Any CPU.Build.0 = Release|Any CPU
- {DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DE5C0467-EE99-4734-95F2-EFF7A0B99924}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE