|
1 | 1 | using System; |
| 2 | +using System.Linq; |
2 | 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; |
3 | 4 | using JSONAPI.Tests.Models; |
4 | 5 | using Newtonsoft.Json; |
@@ -124,6 +125,31 @@ public void SerializerIntegrationTest() |
124 | 125 | //Assert.AreEqual("[2,3,4]", sw.ToString()); |
125 | 126 | } |
126 | 127 |
|
| 128 | + [TestMethod] |
| 129 | + [DeploymentItem(@"Data\SerializerIntegrationTest.json")] |
| 130 | + public void SerializeArrayIntegrationTest() |
| 131 | + { |
| 132 | + // Arrange |
| 133 | + //PayloadConverter pc = new PayloadConverter(); |
| 134 | + //ModelConverter mc = new ModelConverter(); |
| 135 | + //ContractResolver.PluralizationService = new PluralizationService(); |
| 136 | + |
| 137 | + JsonApiFormatter formatter = new JSONAPI.Json.JsonApiFormatter(); |
| 138 | + formatter.PluralizationService = new JSONAPI.Core.PluralizationService(); |
| 139 | + MemoryStream stream = new MemoryStream(); |
| 140 | + |
| 141 | + // Act |
| 142 | + //Payload payload = new Payload(a.Posts); |
| 143 | + //js.Serialize(jw, payload); |
| 144 | + formatter.WriteToStreamAsync(typeof(Post), a.Posts.ToArray(), stream, (System.Net.Http.HttpContent)null, (System.Net.TransportContext)null); |
| 145 | + |
| 146 | + // Assert |
| 147 | + string output = System.Text.Encoding.ASCII.GetString(stream.ToArray()); |
| 148 | + Trace.WriteLine(output); |
| 149 | + Assert.AreEqual(output.Trim(), File.ReadAllText("SerializerIntegrationTest.json").Trim()); |
| 150 | + //Assert.AreEqual("[2,3,4]", sw.ToString()); |
| 151 | + } |
| 152 | + |
127 | 153 | [TestMethod] |
128 | 154 | public void DeserializeCollectionIntegrationTest() |
129 | 155 | { |
|
0 commit comments