public void ToStringSerialisesAllValues() { ChangePasswordRequest request = new ChangePasswordRequest(); request.Identifier = "identifier"; request.OldPassword = "******"; request.NewPassword = "******"; request.UserName = "******"; request.ServerName = "serverName"; request.SessionToken = "sessionToken"; request.SourceName = "sourceName"; request.Timestamp = DateTime.Now; string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<changePasswordMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "timestamp=\"{4:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" server=\"{1}\" source=\"{2}\" session=\"{3}\" oldPassword=\"{5}\" newPassword=\"{6}\" userName=\"{7}\" />", request.Identifier, request.ServerName, request.SourceName, request.SessionToken, request.Timestamp, request.OldPassword, request.NewPassword, request.UserName); XDocument.Parse(actual).Should().BeEquivalentTo(XDocument.Parse(expected)); }
public void ToStringSerialisesDefaultValues() { ChangePasswordRequest request = new ChangePasswordRequest(); string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<changePasswordMessage xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " + "timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" source=\"{1}\" />", request.Identifier, request.SourceName, request.Timestamp); XDocument.Parse(actual).Should().BeEquivalentTo(XDocument.Parse(expected)); }