当前位置: 首页>>代码示例>>C#>>正文


C# User.ToString方法代码示例

本文整理汇总了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());
        }
开发者ID:WinShooter,项目名称:WinShooter-Web,代码行数:27,代码来源:UserTests.cs

示例2: ToStringTest

 public void ToStringTest()
 {
     var target = new User { Name = "Florian" };
     var expected = "Florian";
     var actual = target.ToString();
     Assert.AreEqual(expected, actual);
 }
开发者ID:famstutz,项目名称:YAEM,代码行数:7,代码来源:UserTest.cs

示例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;
 }
开发者ID:joegazz84,项目名称:helpmebot,代码行数:14,代码来源:Myaccess.cs

示例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());
 }
开发者ID:bleissem,项目名称:sharpsnmplib,代码行数:8,代码来源:UserTestFixture.cs

示例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;
 }
开发者ID:awnowlin,项目名称:helpmebot,代码行数:16,代码来源:Part.cs

示例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());

        }
开发者ID:Hejsil,项目名称:2.-Semester-Examen,代码行数:16,代码来源:LineSystemCLI.cs

示例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);
        }
开发者ID:alfaproject,项目名称:Supay.Irc,代码行数:22,代码来源:MaskTests.cs

示例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);
        }
开发者ID:blstream,项目名称:Patronage2013-CaptureTheFlag,代码行数:24,代码来源:UserUnitTest.cs

示例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 );
 }
开发者ID:stwalkerster,项目名称:utility,代码行数:4,代码来源:Irc.cs

示例10: ToStringTest

        public void ToStringTest()
        {
            var user = new User("Hans", "Hansen", "Hanserik", "[email protected]");

            Assert.AreEqual("Hans Hansen([email protected])", user.ToString());
        }
开发者ID:Hejsil,项目名称:2.-Semester-Examen,代码行数:6,代码来源:UserTest.cs

示例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("/*************************************************************************/");
        }
开发者ID:symba2003,项目名称:TradeTheNews-UserTest,代码行数:25,代码来源:Program.cs

示例12: IAL_TopicEvent

 void IAL_TopicEvent( User source, string channel, string topic )
 {
     Log( "TOPIC CHANGED BY " + source.ToString( ) + " IN " + channel + " TOPIC " + topic );
 }
开发者ID:stwalkerster,项目名称:utility,代码行数:4,代码来源:Irc.cs

示例13: IAL_QuitEvent

 void IAL_QuitEvent( User source, string message )
 {
     Log( "QUIT BY " + source.ToString( ) + " MESSAGE " + message );
 }
开发者ID:stwalkerster,项目名称:utility,代码行数:4,代码来源:Irc.cs

示例14: IAL_PrivmsgEvent

 void IAL_PrivmsgEvent( User source, string destination, string message )
 {
     Log( "PRIVMSG EVENT FROM " + source.ToString( ) + " TO " + destination + " MESSAGE " + message );
 }
开发者ID:stwalkerster,项目名称:utility,代码行数:4,代码来源:Irc.cs

示例15: IAL_PartEvent

 void IAL_PartEvent( User source, string channel, string message )
 {
     Log( "PART BY " + source.ToString( ) + " FROM " + channel + " MESSAGE " + message );
 }
开发者ID:stwalkerster,项目名称:utility,代码行数:4,代码来源:Irc.cs


注:本文中的User.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。