public void ToStringSerialisesAllValues() { ChangeConfigurationRequest request = new ChangeConfigurationRequest(); request.Identifier = "identifier"; request.ServerName = "serverName"; request.SessionToken = "sessionToken"; request.SourceName = "sourceName"; request.Timestamp = DateTime.Now; request.ProjectDefinition = "Build#1"; request.PurgeArtifactDirectory = true; request.PurgeSourceControlEnvironment = true; request.PurgeWorkingDirectory = true; string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<changeConfigurationRequest 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}\" " + "purgeWorking=\"true\" purgeArtifact=\"true\" purgeSourceControl=\"true\">" + "<definition>Build#1</definition>" + "</changeConfigurationRequest>", request.Identifier, request.ServerName, request.SourceName, request.SessionToken, request.Timestamp); XDocument.Parse(actual).Should().BeEquivalentTo(XDocument.Parse(expected)); }
public void ToStringSerialisesDefaultValues() { ChangeConfigurationRequest request = new ChangeConfigurationRequest(); string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<changeConfigurationRequest 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}\" " + "purgeWorking=\"false\" purgeArtifact=\"false\" purgeSourceControl=\"false\" />", request.Identifier, request.SourceName, request.Timestamp); XDocument.Parse(actual).Should().BeEquivalentTo(XDocument.Parse(expected)); }