public Simulator(string phonePath, string testPath) { // Read and deserialize the phones: var phoneDicts = CsvReader.ReadCsv(phonePath); Phones = new Dictionary <string, MobilePhone>(phoneDicts.Length); foreach (var dict in phoneDicts) { var phone = PhoneDeserializer.Deserialize(dict); Phones[phone.PhoneNumber] = phone; } // Read and deserialize the tests: var testDicts = CsvReader.ReadCsv(testPath); Tests = new Test[testDicts.Length]; for (int i = 0; i < testDicts.Length; i++) { Tests[i] = TestDeserializer.Deserialize(testDicts[i]); } }
public void DeserializeResourceIdentifiers_SingleData_CanDeserialize() { // Arrange var content = new Document { Data = new ResourceObject { Type = "testResource", Id = "1" } }; string body = JsonConvert.SerializeObject(content); // Act var result = (TestResource)_deserializer.Deserialize(body); // Assert Assert.Equal(1, result.Id); }