public void ShouldReturnB_wingTransportAnd163StopsWhenTheDistanceEqual2MillionAnd500ThousandWhenPageEquals2() { string url = GetUrl("page2.json"); StarShipDTO starShipDTOExpected = CreateStarShip("page3.json", "B-wing", 163); StarShipItemDTO starShipItemDTOExpected = starShipDTOExpected.StarShipItemDTO.First(); StarShipDTO starShipDTO = this.starShipService.GetStopsRequired("2500000", url); StarShipItemDTO starShipItemDTO = starShipDTO.StarShipItemDTO .Where(s => s.Name.Equals(starShipItemDTOExpected.Name)).FirstOrDefault(); Assert.Equal(starShipDTOExpected.NextPage, starShipDTO.NextPage); Assert.Equal(starShipItemDTOExpected.Name, starShipItemDTO.Name); Assert.Equal(starShipItemDTOExpected.StopsRequired, starShipItemDTO.StopsRequired); }
public void ShouldReturnRebelTransportAnd11StopsWhenTheDistanceEqual1MillionWhenPageEquals1() { string url = GetUrl("page1.json"); StarShipDTO starShipDTOExpected = CreateStarShip("page2.json", "Rebel transport", 11); StarShipItemDTO starShipItemDTOExpected = starShipDTOExpected.StarShipItemDTO.First(); StarShipDTO starShipDTO = this.starShipService.GetStopsRequired("1000000", url); StarShipItemDTO starShipItemDTO = starShipDTO.StarShipItemDTO .Where(s => s.Name.Equals(starShipItemDTOExpected.Name)).FirstOrDefault(); Assert.Equal(starShipDTOExpected.NextPage, starShipDTO.NextPage); Assert.Equal(starShipItemDTOExpected.Name, starShipItemDTO.Name); Assert.Equal(starShipItemDTOExpected.StopsRequired, starShipItemDTO.StopsRequired); }
public void ShouldReturnNabooStarSkiffTransportAndNegative1StopsWhenTheDistanceEqual150ThousandAndConsumablesUnknowWhenPageEquals4() { string url = GetUrl("page4.json"); StarShipDTO starShipDTOExpected = CreateStarShip(null, "Naboo star skiff", -1); StarShipItemDTO starShipItemDTOExpected = starShipDTOExpected.StarShipItemDTO.First(); StarShipDTO starShipDTO = this.starShipService.GetStopsRequired("150000", url); StarShipItemDTO starShipItemDTO = starShipDTO.StarShipItemDTO .Where(s => s.Name.Equals(starShipItemDTOExpected.Name)).FirstOrDefault(); Assert.Equal(starShipDTOExpected.NextPage, starShipDTO.NextPage); Assert.Equal(starShipItemDTOExpected.Name, starShipItemDTO.Name); Assert.Equal(starShipItemDTOExpected.StopsRequired, starShipItemDTO.StopsRequired); }
private StarShipDTO CreateStarShip(string nextPage, string starShipName, int stopsRequired) { StarShipDTO starShipDTO = new StarShipDTO(); starShipDTO.NextPage = nextPage; StarShipItemDTO starShipItemDTO = new StarShipItemDTO(); starShipItemDTO.Name = starShipName; starShipItemDTO.StopsRequired = stopsRequired; starShipDTO.StarShipItemDTO.Add(starShipItemDTO); return(starShipDTO); }
public void ShouldReturnRepublicAttackCruiserTransportAndNegative1StopsWhenTheDistanceEqual150ThousandAndMgltUnknowWhenPageEquals3() { string url = GetUrl("page3.json"); StarShipDTO starShipDTOExpected = CreateStarShip("page4.json", "Republic attack cruiser", -1); StarShipItemDTO starShipItemDTOExpected = starShipDTOExpected.StarShipItemDTO.First(); StarShipDTO starShipDTO = this.starShipService.GetStopsRequired("150000", url); StarShipItemDTO starShipItemDTO = starShipDTO.StarShipItemDTO .Where(s => s.Name.Equals(starShipItemDTOExpected.Name)).FirstOrDefault(); Assert.Equal(starShipDTOExpected.NextPage, starShipDTO.NextPage); Assert.Equal(starShipItemDTOExpected.Name, starShipItemDTO.Name); Assert.Equal(starShipItemDTOExpected.StopsRequired, starShipItemDTO.StopsRequired); }