public void ZeroTest() { var testTripCards = new TripCard[0]; var orderedTripCards = _tripCardService.OrderTripCards(testTripCards); Assert.NotEqual(null, orderedTripCards); Assert.Empty(orderedTripCards); }
/// <summary> /// Gets the journy asynchronous. /// </summary> /// <returns></returns> private async Task<string> GetJournyAsync() { TripCard trip1 = new TripCard() { Id = "004", Gate = "22", FlightNumber = "SK22", BaggageTicketCounter = null, Transport = "Airplane", Seat = "7B", Departure = new Location() { City = "Stockolm", Country = "Sweeden" }, Destination = new Location() { City = "New York", Country = "Sweeden" }, }; TripCard trip2 = new TripCard() { Id = "001", Transport = "Train", TrainNumber = "78A", Seat = ("45B"), Departure = new Location() { City = "Madrid", Country = "Spain" }, Destination = new Location() { City = "Barcelona", Country = "Spain" } }; TripCard trip3 = new TripCard() { FlightNumber = "SK455", Gate = "45B", Transport = "Airplane", BaggageTicketCounter = "344", Id = "003", Seat = "3A", Departure = new Location() { City = "Gerona", Country = "Spain" }, Destination = new Location() { City = "Stockolm", Country = "Sweeden" } }; TripCard trip4 = new TripCard() { Id = "002", Seat = null, Transport = "Bus", Departure = new Location() { City = "Barcelona", Country = "Spain" }, Destination = new Location() { City = "Gerona", Country = "Spain" } }; List<TripCard> tripCards = new List<TripCard>() { trip1, trip2, trip3, trip4 }; // Save And Retrive the API URI in web.config file to can edit it after that easly string apiURI = ConfigurationManager.AppSettings["TripSorterAPI_URI"]; // Get client connection with azure mobile service var client = new MobileServiceClient(apiURI); // Call the azure mobile service that i use return await client.InvokeApiAsync<List<TripCard>, string>("TripSorter", tripCards, HttpMethod.Post, null); }
public void Test_MissInputSort() { //arrange var card1 = new TripCard(new City("Мельбурн"), new City("Кельн")); var card2 = new TripCard(new City("Кельн"), new City("Прага")); var card3 = new TripCard(new City("Прага"), new City("Париж")); var card4 = new TripCard(new City("Москва"), new City("Берлин")); TripHelper.Sort(new List <TripCard>() { card1, card3, card2, card4 }); }
public void Test_CorrectInputSort() { //arrange var card1 = new TripCard(new City("Мельбурн"), new City("Кельн")); var card2 = new TripCard(new City("Кельн"), new City("Москва")); var card3 = new TripCard(new City("Москва"), new City("Париж")); var sortedCards = new List <TripCard>() { card1, card2, card3 }; var unsordedCards = new List <TripCard>() { card1, card3, card2, }; //act var result = TripHelper.Sort(unsordedCards); //assert CollectionAssert.AreEqual(sortedCards, result); }
public TripCardElement(TripCard tripCard, int sourceIndex) { TripCard = tripCard; SourceIndex = sourceIndex; }