Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jregnier committed Mar 29, 2019
2 parents 44820c5 + 64cf70e commit e5ce21e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 56 deletions.
2 changes: 1 addition & 1 deletion MtgApiManager.Lib.Test/Model/CardTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void MapCardTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
};

Expand Down
12 changes: 6 additions & 6 deletions MtgApiManager.Lib.Test/Service/CardServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task AllAsyncTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
},
new CardDto()
Expand Down Expand Up @@ -113,7 +113,7 @@ public async Task AllAsyncTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
}
};
Expand Down Expand Up @@ -215,7 +215,7 @@ public void AllTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
},
new CardDto()
Expand Down Expand Up @@ -257,7 +257,7 @@ public void AllTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
}
};
Expand Down Expand Up @@ -358,7 +358,7 @@ public async Task FindAsyncTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
};

Expand Down Expand Up @@ -501,7 +501,7 @@ public void FindTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
};

Expand Down
8 changes: 4 additions & 4 deletions MtgApiManager.Lib.Test/Service/SetServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public async Task GenerateBoosterAsyncTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
},
new CardDto()
Expand Down Expand Up @@ -505,7 +505,7 @@ public async Task GenerateBoosterAsyncTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
}
};
Expand Down Expand Up @@ -606,7 +606,7 @@ public void GenerateBoosterTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
},
new CardDto()
Expand Down Expand Up @@ -648,7 +648,7 @@ public void GenerateBoosterTest()
Toughness = "tough",
Type = "type2",
Types = new string[] { "type1", "type2" },
Variations = new int[] { 1, 2, 3 },
Variations = new string[] { Guid.Empty.ToString() },
Watermark = "watermark"
}
};
Expand Down
2 changes: 1 addition & 1 deletion MtgApiManager.Lib/Dto/Cards/CardDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public string[] Types
}

[JsonProperty(PropertyName = "variations")]
public int[] Variations
public string[] Variations
{
get;
set;
Expand Down
2 changes: 1 addition & 1 deletion MtgApiManager.Lib/Model/Card/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public string[] Types
/// <summary>
/// Gets if a card has alternate art (for example, 4 different Forests, or the 2 Brothers Yamazaki) then each other variation’s multiverseid will be listed here, NOT including the current card’s multiverseid.
/// </summary>
public int[] Variations
public string[] Variations
{
get;
private set;
Expand Down
47 changes: 4 additions & 43 deletions MtgApiManager.Lib/Service/CardService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,60 +120,21 @@ public async override Task<Exceptional<List<Card>>> AllAsync()
/// </summary>
/// <param name="multiverseId">The multi verse identifier to query for.</param>
/// <returns>A <see cref="Exceptional{Card}"/> representing the result containing a <see cref="Card"/> or an exception.</returns>
public Exceptional<Card> Find(int multiverseId)
{
try
{
var rootCard = CallWebServiceGet<RootCardDto>(BuildUri(multiverseId.ToString())).Result;
var model = new Card(rootCard.Card);

return Exceptional<Card>.Success(model, MtgApiController.CreatePagingInfo());
}
catch (AggregateException ex)
{
return Exceptional<Card>.Failure(ex.Flatten().InnerException);
}
}
public Exceptional<Card> Find(int multiverseId) => FindAsync(multiverseId.ToString()).Result;

/// <summary>
/// Find a specific card by its multi verse identifier.
/// </summary>
/// <param name="id">The identifier to query for.</param>
/// <returns>A <see cref="Exceptional{Card}"/> representing the result containing a <see cref="Card"/> or an exception.</returns>
public Exceptional<Card> Find(string id)
{
try
{
var rootCard = CallWebServiceGet<RootCardDto>(BuildUri(id)).Result;
var model = new Card(rootCard.Card);

return Exceptional<Card>.Success(model, MtgApiController.CreatePagingInfo());
}
catch (AggregateException ex)
{
return Exceptional<Card>.Failure(ex.Flatten().InnerException);
}
}
public Exceptional<Card> Find(string id) => FindAsync(id).Result;

/// <summary>
/// Find a specific card by its multi verse identifier.
/// </summary>
/// <param name="multiverseId">The multi verse identifier to query for.</param>
/// <returns>A <see cref="Exceptional{Card}"/> representing the result containing a <see cref="Card"/> or an exception.</returns>
public async Task<Exceptional<Card>> FindAsync(int multiverseId)
{
try
{
var rootCard = await CallWebServiceGet<RootCardDto>(BuildUri(multiverseId.ToString())).ConfigureAwait(false);
var model = new Card(rootCard.Card);

return Exceptional<Card>.Success(model, MtgApiController.CreatePagingInfo());
}
catch (Exception ex)
{
return Exceptional<Card>.Failure(ex);
}
}
public Task<Exceptional<Card>> FindAsync(int multiverseId) => FindAsync(multiverseId.ToString());

/// <summary>
/// Find a specific card by its multi verse identifier.
Expand Down Expand Up @@ -344,4 +305,4 @@ public CardService Where<U>(Expression<Func<CardQueryParameter, U>> property, U
return this;
}
}
}
}

0 comments on commit e5ce21e

Please sign in to comment.