public void Update() { ComposerTypeList composerTypes = new ComposerTypeList(); composerTypes.Load(); ComposerType composerType = composerTypes.FirstOrDefault(ct => ct.Description == "SLTEST"); ComposerType retrievedComposerType = new ComposerType(); if (composerType != null) { retrievedComposerType.Id = composerType.Id; composerType.Description = "SLTEST1"; //Act HttpClient client = InitializeClient(); //Serialize a question object that we're trying to insert string serializedComposerType = JsonConvert.SerializeObject(composerType); var content = new StringContent(serializedComposerType); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PutAsync("ComposerType/" + composerType.Id, content).Result; retrievedComposerType.LoadById(); } //Assert Assert.AreEqual(composerType.Description, retrievedComposerType.Description); }
// GET: api/ComposerType/5 public ComposerType Get(Guid id) { ComposerType composerType = new ComposerType { Id = id }; composerType.LoadById(); return(composerType); }
public void LoadById() { ComposerType composerType = new ComposerType(); ComposerTypeList composerTypes = new ComposerTypeList(); composerTypes.Load(); composerType = composerTypes.FirstOrDefault(c => c.Description == "Update"); ComposerType newComposerType = new ComposerType { Id = composerType.Id }; newComposerType.LoadById(); Assert.AreEqual(composerType.Description, newComposerType.Description); }