public void ShowExtendedCast_ValidId_ReturnCast() { //Arrange _showExtendedService.GetCast(Arg.Any <int>()) .Returns(_jsonSerializeService.SerializeObject(_mockCastDtos)); //Act var cast = _apiClientMock.GetCast(1); //Assert Assert.AreEqual(_jsonSerializeService.SerializeObject(_mockCastDtos), _jsonSerializeService.SerializeObject(cast.Result)); }
public async Task <IEnumerable <CastDto> > GetCast(int showId) { var json = await _showExtendedService.GetCast(showId); var cast = _jsonSerializeService.TryDeserializeObject <IEnumerable <CastDto> >(json); if (cast.success) { return(cast.obj); } throw new Exceptions.InvalidCastException($"Get cast for showId: {showId}"); }