コード例 #1
0
 public void ToStringSerialisesDefaultValues()
 {
     LoginRequest request = new LoginRequest();
     string actual = request.ToString();
     string expected = string.Format("<loginMessage 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);
 }
コード例 #2
0
 public void ToStringSerialisesAllValues()
 {
     LoginRequest request = new LoginRequest();
     request.Identifier = "identifier";
     request.ServerName = "serverName";
     request.SessionToken = "sessionToken";
     request.SourceName = "sourceName";
     request.Timestamp = DateTime.Now;
     request.AddCredential(LoginRequest.UserNameCredential, "johnDoe");
     string actual = request.ToString();
     string expected = string.Format("<loginMessage 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}\">" +
         "<credential name=\"userName\" value=\"johnDoe\" />" +
         "</loginMessage>",
         request.Identifier,
         request.ServerName,
         request.SourceName,
         request.SessionToken,
         request.Timestamp);
     Assert.AreEqual(expected, actual);
 }