-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked tests. Reworked AddParameter method in UriExtensions. Rework…
…ed MovieDb methods.
- Loading branch information
Showing
5 changed files
with
75 additions
and
47 deletions.
There are no files selected for viewing
53 changes: 32 additions & 21 deletions
53
Web Services And Cloud/MovieInfoApp/MovieInfo.Tests/ActorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,58 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
namespace MovieInfo.Tests | ||
namespace MovieInfo.Tests | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using MovieInfoApp; | ||
using MovieInfoApp.Models; | ||
|
||
[TestClass] | ||
public class ActorTests | ||
{ | ||
private static ActorModel actorInfo; | ||
private static CreditsModel credits; | ||
private static string creditsId; | ||
private static SeriesInfo seriesInfo; | ||
private static List<EpisodeModel> episodes; | ||
private static List<SeasonModel> seasons; | ||
|
||
[ClassInitialize] | ||
public static void InitializeData(TestContext context) | ||
{ | ||
GetData(); | ||
} | ||
|
||
//In Game of Thrones Nell Tiger Free plays Myrcella Baratheon, write a test to verify the following; | ||
|
||
[TestMethod] | ||
public void ActorIsNotInSeason6Episode1() | ||
{ | ||
var actorInfo = MovieDb.GetActorInfoByName("Nell Tiger Free"); | ||
var credits = MovieDb.GetTVCreditsByActorId(actorInfo.Id); | ||
var creditsId = credits.FirstOrDefault().CreditsId; | ||
var seriesInfo = MovieDb.GetTVSeriesDetailsByCreditsId(creditsId); | ||
|
||
Assert.IsFalse(seriesInfo.Episodes.Any(e => e.Season == 6 && e.EpisodeNumber == 1)); | ||
Assert.IsFalse(episodes.Any(e => e.Season == 6 && e.EpisodeNumber == 1)); | ||
} | ||
|
||
[TestMethod] | ||
public void ActorIsInSeason5Episode1AsMainCastMemberButNotAsGuest() | ||
{ | ||
var actorInfo = MovieDb.GetActorInfoByName("Nell Tiger Free"); | ||
var credits = MovieDb.GetTVCreditsByActorId(actorInfo.Id); | ||
var creditsId = credits.FirstOrDefault().CreditsId; | ||
var seriesInfo = MovieDb.GetTVSeriesDetailsByCreditsId(creditsId); | ||
|
||
Assert.IsTrue(seriesInfo.Seasons.Any(s => s.SeasonNumber == 5)); | ||
Assert.IsFalse(seriesInfo.Episodes.Any(e => e.Season == 5 && e.EpisodeNumber == 1)); | ||
Assert.IsTrue(seasons.Any(s => s.SeasonNumber == 5)); | ||
Assert.IsFalse(episodes.Any(e => e.Season == 5 && e.EpisodeNumber == 1)); | ||
} | ||
|
||
[TestMethod] | ||
public void ActorIsInSeason5Episode2AsMainCastMemberAndAsGuest() | ||
{ | ||
var actorInfo = MovieDb.GetActorInfoByName("Nell Tiger Free"); | ||
var credits = MovieDb.GetTVCreditsByActorId(actorInfo.Id); | ||
var creditsId = credits.FirstOrDefault().CreditsId; | ||
var seriesInfo = MovieDb.GetTVSeriesDetailsByCreditsId(creditsId); | ||
Assert.IsTrue(seasons.Any(s => s.SeasonNumber == 5)); | ||
Assert.IsTrue(episodes.Any(e => e.Season == 5 && e.EpisodeNumber == 2)); | ||
} | ||
|
||
Assert.IsTrue(seriesInfo.Seasons.Any(s => s.SeasonNumber == 5)); | ||
Assert.IsTrue(seriesInfo.Episodes.Any(e => e.Season == 5 && e.EpisodeNumber == 2)); | ||
private static void GetData() | ||
{ | ||
actorInfo = MovieDb.GetActorInfoByName("Nell Tiger Free").Result; | ||
credits = MovieDb.GetTVCreditsByActorId(actorInfo.Id).Result.FirstOrDefault(); | ||
creditsId = credits.CreditsId; | ||
seriesInfo = MovieDb.GetTVSeriesDetailsByCreditsId(creditsId).Result; | ||
episodes = seriesInfo.Episodes; | ||
seasons = seriesInfo.Seasons; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Web Services And Cloud/MovieInfoApp/MovieInfoApp/Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Linq; | ||
|
||
|
||
namespace MovieInfoApp | ||
{ | ||
class Startup | ||
{ | ||
public static void Main() | ||
{ | ||
|
||
var actor = MovieDb.GetActorInfoByName("Nell Tiger Free"); | ||
var credits = MovieDb.GetTVCreditsByActorId(actor.Id); | ||
var creditsId = credits.Result.FirstOrDefault().CreditsId; | ||
var seriesInfo = MovieDb.GetTVSeriesDetailsByCreditsId(creditsId); | ||
|
||
Console.WriteLine(creditsId); | ||
Console.WriteLine(seriesInfo.Result.Episodes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters