コード例 #1
0
        protected async Task <string> GetAuthTokenAsync()
        {
            var configurationValues = new TheTvDbConfigurationValuesV4(new TestConfigurationValues());
            var localPaths          = new TestLocalPaths();
            var apiDownloader       = CreateDownloader();
            var authenticator       =
                new TheTvDbAuthenticatorV4(new RealTimeDateProvider(), configurationValues, localPaths, apiDownloader);

            return(await authenticator.GetAuthTokenAsync(null));
        }
コード例 #2
0
        public async Task AuthenticatorShouldRetrieveAndReturnToken()
        {
            // Arrange
            var configurationValues = new TheTvDbConfigurationValuesV4(new TestConfigurationValues());
            var localPaths          = new TestLocalPaths();
            var apiDownloader       = new TheTvDbApiDownloaderV4(configurationValues, new HttpDownloader());
            var sut = new TheTvDbAuthenticatorV4(new RealTimeDateProvider(), configurationValues, localPaths, apiDownloader);

            // Act
            var actual = await sut.GetAuthTokenAsync(null);

            // Assert
            Assert.That(actual, Is.Not.Null);
            Assert.That(actual, Is.Not.Empty);

            Console.WriteLine(actual);
        }