Exemple #1
0
        public async Task ShouldAddLuggageSuccessfully()
        {
            string tag = Guid.NewGuid().ToString();

            luggage.LuggageId = tag;

            await DALContext.AddLuggage(luggage);

            Luggage newLuggage = await DALContext.GetLuggage(tag);

            Assert.AreEqual(tag, newLuggage.LuggageId);
            Assert.AreEqual(weight, newLuggage.Weight);
            Assert.AreEqual(measurement, newLuggage.Measurement);
            Assert.AreEqual(name, newLuggage.Name);
            Assert.AreEqual(description, newLuggage.Description);
            Assert.AreEqual(lastStatusChange, newLuggage.LastStatusChange);

            Assert.AreEqual(testStatusDescription, newLuggage.Status.StatusDescription);
            Assert.AreEqual(status, newLuggage.Status.Status);
            Assert.AreEqual(luggageStatusId, newLuggage.Status.LuggageStatusId);
            Assert.AreEqual(longitude, newLuggage.Status.Location.Longitude);
            Assert.AreEqual(latitude, newLuggage.Status.Location.Latitude);
            Assert.AreEqual(lastStatusChange, newLuggage.Status.DateTimeStamp);
        }
Exemple #2
0
 public async Task AddLuggage(Luggage luggage)
 {
     try
     {
         Validator.ValidateLuggageOrThrowException(luggage);
         await DAL.AddLuggage(luggage);
     }
     catch (Exception ex)
     {
         throw new LuggageTrackerBizContextException("Failed to add luggage", ex)
               {
                   StatusCode = HttpStatusCode.InternalServerError,
               };
     }
 }