Пример #1
0
        public void Initialize()
        {
            if (string.IsNullOrEmpty(ApiKey))
            {
                throw new ArgumentNullException("Fill in the value of your personal api key. The api key can be obtained from WeTransfer.");
            }
            _appPath = AppDomain.CurrentDomain.BaseDirectory;
            _user    = "******";
            var chunkDirectory = Path.Combine(_appPath, "Chunks");

            _communicator = new TransferApiCommunicator(ApiKey, chunkDirectory);
            if (TransferApiCommunicator.Token == null)
            {
                _communicator.GetToken(_user).Wait();
            }
        }
Пример #2
0
        public void GetToken()
        {
            //Arrange
            TransferApiCommunicator.ClearToken();
            var token = TransferApiCommunicator.Token;

            Assert.IsNull(TransferApiCommunicator.Token);

            //Act
            var response = _communicator.GetToken(_user).Result;

            //Assert
            Assert.IsTrue(response.Success.Value);
            token = response.Token;
            Assert.IsFalse(string.IsNullOrEmpty(token));
            _token = token;
        }