protected override void LoadModel(object savedModel) { IDictionary model = (IDictionary)savedModel; flights = (FlightSuggestions)model["flights"]; outboundFlightIndex = (int)model["outboundFlightIndex"]; returnFlightIndex = (int)model["returnFlightIndex"]; }
public void XmlSerialisationTest() { FlightSuggestions suggestionsBefore = new FlightSuggestions(); suggestionsBefore.OutboundFlights.Add(new Flight()); suggestionsBefore.OutboundFlights.Add(new Flight()); suggestionsBefore.ReturnFlights.Add(new Flight()); XmlSerializer s = new XmlSerializer(typeof(FlightSuggestions)); StringWriter sw = new StringWriter(); s.Serialize(sw, suggestionsBefore); StringReader sr = new StringReader (sw.ToString()); FlightSuggestions suggestionsAfter = (FlightSuggestions) s.Deserialize (sr); Assert.AreEqual(2, suggestionsAfter.OutboundFlights.Count); Assert.AreEqual(1, suggestionsAfter.ReturnFlights.Count); }
public void XmlSerialisationTest() { FlightSuggestions suggestionsBefore = new FlightSuggestions(); suggestionsBefore.OutboundFlights.Add(new Flight()); suggestionsBefore.OutboundFlights.Add(new Flight()); suggestionsBefore.ReturnFlights.Add(new Flight()); XmlSerializer s = new XmlSerializer(typeof(FlightSuggestions)); StringWriter sw = new StringWriter(); s.Serialize(sw, suggestionsBefore); StringReader sr = new StringReader(sw.ToString()); FlightSuggestions suggestionsAfter = (FlightSuggestions)s.Deserialize(sr); Assert.AreEqual(2, suggestionsAfter.OutboundFlights.Count); Assert.AreEqual(1, suggestionsAfter.ReturnFlights.Count); }
protected override void InitializeModel() { flights = (FlightSuggestions) Session[Constants.SuggestedFlightsKey]; outboundFlightIndex = NoFlightSelected; returnFlightIndex = NoFlightSelected; }