public void QueryFirstTravelItemTest() { TravelModelContainer ctx = new TravelModelContainer(); var query = from t in ctx.Travels select t; Travel travelView = query.FirstOrDefault(); Assert.IsNotNull(travelView); ctx.Dispose(); }
public void InsertIntoTravelTest() { TravelModelContainer ctx = new TravelModelContainer(); var travel = CreateTravelViewTest(); ctx.Travels.AddObject(travel); int result = ctx.SaveChanges(); Assert.AreEqual(result, 1); ctx.Dispose(); }
public Travel QueryTravelItemTest(string partitionKey, Guid rowKey, bool allowNull = false) { TravelModelContainer ctx = new TravelModelContainer(); var query = from t in ctx.Travels where t.PartitionKey == partitionKey && t.RowKey == rowKey select t; Travel travelView = query.FirstOrDefault(); if (!allowNull) { Assert.IsNotNull(travelView); } ctx.Dispose(); return(travelView); }
public void UpdateTravelTest() { TravelModelContainer ctx = new TravelModelContainer(); Travel travel = ctx.Travels.First(); travel.Place = "New York"; int result = ctx.SaveChanges(); Assert.AreEqual(result, 1); Travel returnedTravel = this.QueryTravelItemTest(travel.PartitionKey, travel.RowKey); Assert.AreEqual(returnedTravel.Place, "New York"); ctx.Dispose(); }
public void DeleteFromTravelTest() { TravelModelContainer ctx = new TravelModelContainer(); Travel travel = ctx.Travels.First(); ctx.Travels.DeleteObject(travel); int result = ctx.SaveChanges(); Assert.AreEqual(result, 1); Travel returnedTravel = this.QueryTravelItemTest(travel.PartitionKey, travel.RowKey, true); Assert.IsNull(returnedTravel); ctx.Dispose(); }