public void should_serialize() { var ob = new ClassWithFileName { File = new FileNameWithExtension("Path to.file") }; var json = JsonConvert.SerializeObject(ob); Assert.AreEqual("{\"File\":{\"FileName\":\"Path to\",\"Extension\":\"file\"}}", json); }