本文整理汇总了C#中User.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# User.ToString方法的具体用法?C# User.ToString怎么用?C# User.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToStringTest
public void ToStringTest()
{
var user = new User { Id = Guid.Parse("74ec4f92-4b72-4c40-927a-de308269e074") };
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"\", Surname=\"\", CardNumber=\"\", Email=\"\", LastLogin=0001-01-01 00:00:00, LastUpdated=0001-01-01 00:00:00 ]", user.ToString());
user.CardNumber = "123";
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"\", Surname=\"\", CardNumber=\"123\", Email=\"\", LastLogin=0001-01-01 00:00:00, LastUpdated=0001-01-01 00:00:00 ]", user.ToString());
user.ClubId = Guid.Parse("74ec4f92-4b72-4c40-927a-de308269e123");
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"\", Surname=\"\", CardNumber=\"123\", Email=\"\", ClubId=74ec4f92-4b72-4c40-927a-de308269e123, LastLogin=0001-01-01 00:00:00, LastUpdated=0001-01-01 00:00:00 ]", user.ToString());
user.Email = "[email protected]";
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"\", Surname=\"\", CardNumber=\"123\", Email=\"[email protected]\", ClubId=74ec4f92-4b72-4c40-927a-de308269e123, LastLogin=0001-01-01 00:00:00, LastUpdated=0001-01-01 00:00:00 ]", user.ToString());
user.Givenname = "Givenname";
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"Givenname\", Surname=\"\", CardNumber=\"123\", Email=\"[email protected]\", ClubId=74ec4f92-4b72-4c40-927a-de308269e123, LastLogin=0001-01-01 00:00:00, LastUpdated=0001-01-01 00:00:00 ]", user.ToString());
user.LastLogin = DateTime.Parse("2014-01-06 21:29:12");
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"Givenname\", Surname=\"\", CardNumber=\"123\", Email=\"[email protected]\", ClubId=74ec4f92-4b72-4c40-927a-de308269e123, LastLogin=2014-01-06 21:29:12, LastUpdated=0001-01-01 00:00:00 ]", user.ToString());
user.LastUpdated = DateTime.Parse("2014-01-06 21:30:45");
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"Givenname\", Surname=\"\", CardNumber=\"123\", Email=\"[email protected]\", ClubId=74ec4f92-4b72-4c40-927a-de308269e123, LastLogin=2014-01-06 21:29:12, LastUpdated=2014-01-06 21:30:45 ]", user.ToString());
user.Surname = "Surname";
Assert.AreEqual("User [ Id=74ec4f92-4b72-4c40-927a-de308269e074, Givenname=\"Givenname\", Surname=\"Surname\", CardNumber=\"123\", Email=\"[email protected]\", ClubId=74ec4f92-4b72-4c40-927a-de308269e123, LastLogin=2014-01-06 21:29:12, LastUpdated=2014-01-06 21:30:45 ]", user.ToString());
}
示例2: ToStringTest
public void ToStringTest()
{
var target = new User { Name = "Florian" };
var expected = "Florian";
var actual = target.ToString();
Assert.AreEqual(expected, actual);
}
示例3: execute
/// <summary>
/// Actual command logic
/// </summary>
/// <param name="source">The user who triggered the command.</param>
/// <param name="channel">The channel the command was triggered in.</param>
/// <param name="args">The arguments to the command.</param>
/// <returns></returns>
protected override CommandResponseHandler execute(User source, string channel, string[] args)
{
CommandResponseHandler crh = new CommandResponseHandler();
string[] cmdArgs = {source.ToString(), source.accessLevel.ToString()};
crh.respond(new Message().get("cmdAccess", cmdArgs));
return crh;
}
示例4: TestException
public void TestException()
{
Assert.Throws<ArgumentNullException>(() => new User(null, null));
Assert.Throws<ArgumentNullException>(() => new User(new OctetString("test"), null));
var user = new User(new OctetString("test"), DefaultPrivacyProvider.DefaultPair);
Assert.AreEqual("User: name: test; provider: Default privacy provider", user.ToString());
}
示例5: execute
/// <summary>
/// Actual command logic
/// </summary>
/// <param name="source">The user who triggered the command.</param>
/// <param name="channel">The channel the command was triggered in.</param>
/// <param name="args">The arguments to the command.</param>
/// <returns></returns>
protected override CommandResponseHandler execute(User source, string channel, string[] args)
{
Helpmebot6.irc.ircPart(channel, source.ToString());
Dictionary<string, string> vals = new Dictionary<string, string>
{ { "channel_enabled", "0" } };
DAL.singleton().update("channel", vals, 0, new DAL.WhereConds("channel_name", channel),
new DAL.WhereConds("channel_network", source.network.ToString()));
return null;
}
示例6: DisplayUserInfo
public void DisplayUserInfo(User user)
{
var transactions = LineSystem.GetTransactionList(user);
transactions.Sort();
Console.WriteLine(user.ToString());
Console.WriteLine("Balance: {0}\n", user.Balance.ToKr());
if (user.Balance < 5000)
Console.WriteLine("Warning. Your balance is less than 50,00 kr. We recommend you refill before next purcash.\n");
Console.WriteLine("Latest transactions:");
for (int i = 0; i < 10 && i < transactions.Count; i++)
Console.WriteLine(transactions[i].ToString());
}
示例7: RoundTrip
public void RoundTrip()
{
var raw = "[email protected]";
var m = new User(raw);
var parsed = m.ToString();
Assert.AreEqual(raw, parsed);
raw = "foo!*@*.edu";
m = new User(raw);
parsed = m.ToString();
Assert.AreEqual(raw, parsed);
raw = "[email protected]";
m = new User(raw);
parsed = m.ToString();
Assert.AreEqual(raw, parsed);
raw = "foo";
m = new User(raw);
parsed = m.ToString();
Assert.AreEqual(raw, parsed);
}
示例8: TestToString
public void TestToString()
{
string username = "[email protected]";
string access_token = "d53e57c6-cb45-481c-9ed4-df15803f0e0d";
string token_type = "bearer";
string scope = "read write";
string FullUserJSON = "{ ";
FullUserJSON += "\"username\" : \"" + username + "\", ";
FullUserJSON += "\"access_token\" : \"" + access_token + "\", ";
FullUserJSON += "\"token_type\" : \"" + token_type + "\", ";
FullUserJSON += "\"scope\" : \"" + scope + "\" ";
FullUserJSON += " }";
string EmptyUserJSON = "{ ";
EmptyUserJSON += "\"username\" : \"" + String.Empty + "\", ";
EmptyUserJSON += "\"access_token\" : \"" + String.Empty + "\", ";
EmptyUserJSON += "\"token_type\" : \"" + String.Empty + "\", ";
EmptyUserJSON += "\"scope\" : \"" + String.Empty + "\" ";
EmptyUserJSON += " }";
User allFilledUser = new User(username, access_token, token_type, scope);
User allEmptyUser = new User(String.Empty, String.Empty, String.Empty, String.Empty);
Assert.AreEqual(allFilledUser.ToString(), FullUserJSON);
Assert.AreEqual(allEmptyUser.ToString(), EmptyUserJSON);
}
示例9: IAL_KickEvent
void IAL_KickEvent( User source, string channel, string nick, string message )
{
Log( "KICK FROM " + channel + " BY " + source.ToString( ) + " AFFECTED " + nick + " REASON " + message );
}
示例10: ToStringTest
public void ToStringTest()
{
var user = new User("Hans", "Hansen", "Hanserik", "[email protected]");
Assert.AreEqual("Hans Hansen([email protected])", user.ToString());
}
示例11: TestUserCopies
static void TestUserCopies()
{
// Test user copies
Console.WriteLine("/**************************************************************************/");
Console.WriteLine("Test User Copies");
Console.WriteLine("Create second user based on first user fields. Create third user as \"user3 = user;\"");
User u1 = new User(1, "family", "name");
User u2 = new User(u1.UserID, u1.FamilyName, u1.GivenName);
User u3 = u1;
Console.WriteLine("First user: " + u1.ToString());
Console.WriteLine("SecondUser: " + u2.ToString());
Console.WriteLine("ThirdUser: " + u3.ToString());
Console.WriteLine("Change first user's family, and look if it changes in the second user and third.");
u1.FamilyName = "new_family";
//По идее, u1 теперь ссылается на др строку (это связано с особенностями работы со строками)
Console.WriteLine("First user: " + u1.ToString());
Console.WriteLine("SecondUser: " + u2.ToString());
Console.WriteLine("ThirdUser: " + u3.ToString());
Assert.AreNotEqual(u1.FamilyName, u2.FamilyName);
Assert.AreEqual(u1.FamilyName, u3.FamilyName);
Console.WriteLine("/*************************************************************************/");
}
示例12: IAL_TopicEvent
void IAL_TopicEvent( User source, string channel, string topic )
{
Log( "TOPIC CHANGED BY " + source.ToString( ) + " IN " + channel + " TOPIC " + topic );
}
示例13: IAL_QuitEvent
void IAL_QuitEvent( User source, string message )
{
Log( "QUIT BY " + source.ToString( ) + " MESSAGE " + message );
}
示例14: IAL_PrivmsgEvent
void IAL_PrivmsgEvent( User source, string destination, string message )
{
Log( "PRIVMSG EVENT FROM " + source.ToString( ) + " TO " + destination + " MESSAGE " + message );
}
示例15: IAL_PartEvent
void IAL_PartEvent( User source, string channel, string message )
{
Log( "PART BY " + source.ToString( ) + " FROM " + channel + " MESSAGE " + message );
}