public void ToStringSerialisesAllValues() { ReadAuditRequest request = new ReadAuditRequest(); request.Identifier = "identifier"; request.StartRecord = 10; request.NumberOfRecords = 20; request.Filter = AuditFilters.ByProject("testing"); 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, "<readAuditMessage 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}\" start=\"{5}\" number=\"{6}\">" + "<filter xsi:type=\"ProjectAuditFilter\" project=\"testing\" />" + "</readAuditMessage>", request.Identifier, request.ServerName, request.SourceName, request.SessionToken, request.Timestamp, request.StartRecord, request.NumberOfRecords); Assert.AreEqual(expected, actual); }
public void ToStringSerialisesDefaultValues() { ReadAuditRequest request = new ReadAuditRequest(); string actual = request.ToString(); string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<readAuditMessage 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); Assert.AreEqual(expected, actual); }