public void Deserialize_SerializedObjectParameterIsNull_ArgumentNullExceptionIsThrown() { // Arrange var jsonObjectSerializer = new JSONObjectSerializer<PublishConfiguration>(); string serializedObject = null; // Act jsonObjectSerializer.Deserialize(serializedObject); }
public void Deserialize_PublishConfiguration_SerializedObjectIsValidJson_ResultIsNotNull() { // Arrange var jsonObjectSerializer = new JSONObjectSerializer<PublishConfiguration>(); var name = Guid.NewGuid().ToString(); var location = Guid.NewGuid().ToString(); var apiKey = Guid.NewGuid().ToString(); string serializedObject = string.Format("{{ Name: \"{0}\", PublishLocation: \"{1}\", ApiKey: \"{2}\" }}", name, location, apiKey); // Act var result = jsonObjectSerializer.Deserialize(serializedObject); // Assert Assert.IsNotNull(result); }
public void Deserialize_PublishConfiguration_SerializedObjectIsValidJson_ResultContainsCorrectProperties() { // Arrange var jsonObjectSerializer = new JSONObjectSerializer<PublishConfiguration>(); var name = Guid.NewGuid().ToString(); var location = Guid.NewGuid().ToString(); var apiKey = Guid.NewGuid().ToString(); string serializedObject = string.Format("{{ Name: \"{0}\", PublishLocation: \"{1}\", ApiKey: \"{2}\" }}", name, location, apiKey); // Act var result = jsonObjectSerializer.Deserialize(serializedObject); // Assert Assert.AreEqual(name, result.Name); Assert.AreEqual(location, result.PublishLocation); Assert.AreEqual(apiKey, result.ApiKey); }