public void UpdateInstrument_creates_new_instrument_and_returns_ok() { Instrument instrument = new AnonymousInstrumentBuilder().build(); string result = WebMethods.InstrumentMethods.UpdateInstrument(instrument); result = XElement.Parse(result).Value; Assert.IsTrue(result == "ok", string.Format("Instrument with id {0} could not be created/updated. Unexpected return value: {1}", instrument.Id, result)); }
public void UpdateInstrument_with_values_saves_all_data_correctly() { Instrument instrument = new AnonymousInstrumentBuilder().build(); //save the instrument to the webshop string result = WebMethods.InstrumentMethods.UpdateInstrument(instrument); result = XElement.Parse(result).Value; Assert.IsTrue(result == "ok", string.Format("Intrument with id {0} could not be created/updated. Unexpected return value was: {1}", instrument.Id, result)); //retrieve the instrument from the webshop string errorMsg; Instrument instrumentFromWS = WebMethods.InstrumentMethods.GetInstrumentById(instrument.Id, out errorMsg); //compare all values Assert.AreEqual(instrument.Id, instrumentFromWS.Id, "The field comparison for field \"id\" failed."); Assert.AreEqual(instrument.Name_NL, instrumentFromWS.Name_NL, "The field comparison for field \"name_nl\" failed."); Assert.AreEqual(instrument.Test, instrumentFromWS.Test, "The field comparison for field \"test\" failed."); Assert.AreEqual(instrument.CreatedDttm, instrumentFromWS.CreatedDttm, "The field comparison for field \"created\" failed."); Assert.AreEqual(instrument.UpdatedDttm, instrumentFromWS.UpdatedDttm, "The field comparison for field \"updated\" failed."); Assert.AreEqual(instrument.DeletedDttm, instrumentFromWS.DeletedDttm, "The field comparison for field \"deleted\" failed."); }