public void TestToDict() { var section = new SectionModel { Name = "Login", Description = "Description Content", ParentId = 1 }; var dict = new Dictionary <string, object> { ["name"] = "Login", ["description"] = "Description Content", ["parent_id"] = 1 }; section.ToDict().Should().BeEquivalentTo(dict); }
public SectionModel CreateSection(SectionModel section) { Console.WriteLine($"Creating section: {section.Name}"); // Send the request var response = (JObject)SendRequest(_testRailApiClient.SendPost, "add_section/" + _testRailProjectId, section.ToDict()); var createdSection = new SectionModel { Name = (string)response["name"], Description = (string)response["description"], Depth = (int)response["depth"], Id = (int)response["id"], ParentId = (int?)response["parent_id"] }; return createdSection; }