public void SigmaGraphJsonConstructor_WithValidInput_ParsesJson() { string json = SigmaGraphFactory.GetValidSigmaGraphJson(); SigmaGraph graph = new SigmaGraph(json); Assert.IsTrue(graph.nodes.Count == 2); Assert.IsTrue(graph.edges.Count == 1); }
public async Task Post_AddNodeReturnsSuccessAndCorrectContent() { var client = _factory.CreateClient(); var vm = new AddNodeViewModel(); vm.SigmaGraphJson = SigmaGraphFactory.GetValidSigmaGraphJson(); vm.Value = 5; var json = JsonConvert.SerializeObject(vm); var content = new StringContent(json, Encoding.UTF8, "application/x-ww-form-urlencoded"); HttpResponseMessage response = await client.PostAsync("/AddNode", content); response.EnsureSuccessStatusCode(); Assert.Equal("text/html; charset=utf-8", response.Content.Headers.ContentType.ToString()); }