コード例 #1
0
        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);
        }
コード例 #2
0
        // GET: api/ComposerType/5
        public ComposerType Get(Guid id)
        {
            ComposerType composerType = new ComposerType {
                Id = id
            };

            composerType.LoadById();
            return(composerType);
        }
コード例 #3
0
        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);
        }