Repository rearrangement
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using YouTube.Models;
|
||||
|
||||
namespace YouTube.API.Test
|
||||
{
|
||||
public class ClosedCaptionsTest
|
||||
{
|
||||
[Test]
|
||||
public void ValidCaptionsTest()
|
||||
{
|
||||
ExtendedYouTubeService service = new ExtendedYouTubeService();
|
||||
ClosedCaptionInfo info = service.VideoPlayback.List("VC5-YkjMHuw").Execute().ClosedCaptions.FirstOrDefault();
|
||||
ClosedCaptionTrack track = service.Captions.Load(info).Execute();
|
||||
Assert.IsNotNull(track);
|
||||
Assert.IsNotEmpty(track.Captions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using YouTube.Models;
|
||||
|
||||
namespace YouTube.API.Test
|
||||
{
|
||||
public class DashManifestTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ValidManifestTest()
|
||||
{
|
||||
ExtendedYouTubeService service = new ExtendedYouTubeService();
|
||||
IReadOnlyList<DashManifest> manifests = service.DashManifests.List("NkGbcQwWxqk").Execute();
|
||||
foreach (var i in manifests)
|
||||
Console.WriteLine(i.Label);
|
||||
Assert.IsNotNull(manifests);
|
||||
Assert.IsNotEmpty(manifests);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using YouTube.Models;
|
||||
|
||||
namespace YouTube.API.Test
|
||||
{
|
||||
public class VideoPlaybackTest
|
||||
{
|
||||
[Test]
|
||||
public void ValidVideoPlaybackTest()
|
||||
{
|
||||
ExtendedYouTubeService service = new ExtendedYouTubeService();
|
||||
VideoPlayback info = service.VideoPlayback.List("VC5-YkjMHuw").Execute();
|
||||
Assert.NotNull(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Google.Apis.Auth.OAuth2;
|
||||
using Google.Apis.Services;
|
||||
using Google.Apis.YouTube.v3.Data;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using YouTube.Authorization;
|
||||
using YouTube.Resources;
|
||||
|
||||
namespace YouTube.API.Test
|
||||
{
|
||||
public class WatchLaterTest
|
||||
{
|
||||
const string testVideoId = "NkGbcQwWxqk";
|
||||
ExtendedYouTubeService service;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var task = AuthorizationHelpers.ExchangeToken(new ClientSecrets
|
||||
{
|
||||
ClientId = "1096685398208-u95rcpkqb4e1ijfmb8jdq3jsg37l8igv.apps.googleusercontent.com",
|
||||
ClientSecret = "IU5bbdjwvmx8ttJoXQ7e6JWd"
|
||||
}, "4/twFMhT4xSaAxls-rEayp8MxFI2Oy0knUdDbAXKnfyMkbDHaNyqhV6uM");
|
||||
task.Wait();
|
||||
|
||||
UserCredential credential = task.Result;
|
||||
service = new ExtendedYouTubeService(new BaseClientService.Initializer
|
||||
{
|
||||
HttpClientInitializer = credential,
|
||||
ApplicationName = "FoxTube"
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AddVideoTest()
|
||||
{
|
||||
WatchLaterResource.InsertRequest request = service.WatchLater.Insert(testVideoId, "snippet");
|
||||
PlaylistItem item = request.Execute();
|
||||
Console.WriteLine(JsonConvert.SerializeObject(item));
|
||||
Assert.IsNotNull(item);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteVideoTest()
|
||||
{
|
||||
WatchLaterResource.DeleteRequest request = service.WatchLater.Delete(testVideoId);
|
||||
request.Execute();
|
||||
Assert.Pass();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="nunit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\YouTube.API\YouTube.API.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user