System.Diagnostics.Trace.WriteLine(string)

Here are the examples of the csharp api System.Diagnostics.Trace.WriteLine(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1505 Examples 7

19 View Source File : RedisSentinelManager.cs
License : MIT License
Project Creator : 2881099

string SetSlave(string name, int timeout)
        {
            for (int i = 0; i < _sentinels.Count; i++)
            {
                if (i > 0)
                    Next();

                using (var sentinel = Current())
                {
                    try
                    {
                        if (!sentinel.Connect(timeout))
                            continue;
                    }
                    catch (Exception)
                    {
                        continue;
                    }

                    var slaves = sentinel.Slaves(name);
                    if (slaves == null)
                        continue;

                    foreach (var slave in slaves)
                    {
                        if (_redisClient != null)
                            _redisClient.Dispose();
                        _redisClient = new RedisClient(slave.Ip, slave.Port);
                        _redisClient.Connected += OnConnectionConnected;

                        try
                        {
                            if (!_redisClient.Connect(timeout))
                                continue;

                            var role = _redisClient.Role();
                            if (role.RoleName != "slave")
                                continue;

                            foreach (var remoteSentinel in sentinel.Sentinels(name))
                                Add(remoteSentinel.Ip, remoteSentinel.Port);

                        }
                        catch (Exception ex)
                        {
                            Trace.WriteLine(ex.Message);
                            Console.WriteLine(ex.Message);
                            continue;
                        }

                        return slave.Ip + ':' + slave.Port;
                    }
                }

            }
            return null;
        }

19 View Source File : RedisSentinelManager.cs
License : MIT License
Project Creator : 2881099

string SetMaster(string name, int timeout)
        {
            for (int i = 0; i < _sentinels.Count; i++)
            {
                if (i > 0)
                    Next();

                using (var sentinel = Current())
                {
                    try
                    {
                        if (!sentinel.Connect(timeout))
                            continue;
                    }
                    catch (Exception)
                    {
                        continue;
                    }

                    var master = sentinel.GetMasterAddrByName(name);
                    if (master == null)
                        continue;

                    if (_redisClient != null)
                        _redisClient.Dispose();

                    if (SentinelMasterConverter != null)
                        master = SentinelMasterConverter(master);

                    _redisClient = new RedisClient(master.Item1, master.Item2);
                    _redisClient.Connected += OnConnectionConnected;

                    try
                    {
                        if (!_redisClient.Connect(timeout))
                            continue;

                        var role = _redisClient.Role();
                        if (role.RoleName != "master")
                            continue;

                        //测试 write
                        var testid = Guid.NewGuid().ToString("N");
                        _redisClient.StartPipe();
                        _redisClient.Set(testid, 1);
                        _redisClient.Del(testid);
                        _redisClient.EndPipe();

                        foreach (var remoteSentinel in sentinel.Sentinels(name))
                            Add(remoteSentinel.Ip, remoteSentinel.Port);

                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine(ex.Message);
                        Console.WriteLine(ex.Message);
                        continue;
                    }

                    return master.Item1 + ':' + master.Item2;
                }

            }
            return null;
        }

19 View Source File : PubSubTests.cs
License : MIT License
Project Creator : 2881099

[Fact]
        public void Subscribe()
        {
            var key1 = "Subscribe1";
            var key2 = "Subscribe2";

            bool isbreak = false;
            new Thread(() =>
            {
                while (isbreak == false)
                {
                    cli.Publish(key1, Guid.NewGuid().ToString());
                    cli.Publish(key2, Guid.NewGuid().ToString());
                    cli.Publish("randomSubscribe1", Guid.NewGuid().ToString());
                    Thread.CurrentThread.Join(100);
                }
            }).Start();

            using (cli.Subscribe(key1, ondata))
            {
                using (cli.Subscribe(key2, ondata))
                {
                    using (cli.PSubscribe("*", ondata))
                    {
                        Thread.CurrentThread.Join(2000);
                    }
                    Thread.CurrentThread.Join(2000);
                }
                Thread.CurrentThread.Join(2000);
            }
            Trace.WriteLine("one more time");
            using (cli.Subscribe(key1, ondata))
            {
                using (cli.Subscribe(key2, ondata))
                {
                    using (cli.PSubscribe("*", ondata))
                    {
                        Thread.CurrentThread.Join(2000);
                    }
                    Thread.CurrentThread.Join(2000);
                }
                Thread.CurrentThread.Join(2000);
            }
            void ondata(string channel, object data)
            {
                Trace.WriteLine($"{channel} -> {data}");
            }
            isbreak = true;
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void ButtonTemplateTest()
        {
            var buttons = new List<IButton>();
            buttons.Add(new UrlButton()
            {
                replacedle = "Url Button",
                Url = "http://m.me"
            });

            buttons.Add(new PostbackButton()
            {
                replacedle = "Post Back Button",
                Payload = "webhook_value"
            });

            buttons.Add(new CallButton()
            {
                replacedle = "Call button",
                Payload = "+123456789"
            });

            var attachment = new Attachment<ButtonTemplate>()
            {
                Payload = new ButtonTemplate()
                {
                    Text = "Button Template Test",
                    Buttons = buttons
                }
            };

            string result = client.SendAttachment<ButtonTemplate>(UserId.ToString(), attachment).Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : BroadcastClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void CreateMessageTest()
        {
            var r = BroadcastMessageResult.CreateFailed<BroadcastMessageResult>();
            var result = client.CreateMessageAsync("Broadcasted message").Result;
            message = result;
            Trace.WriteLine($"Message Id: {result.Id}");
        }

19 View Source File : BroadcastClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void CreateMessageWithQuickReplyTest()
        {
            List<QuickReply> qrl = new List<QuickReply>();
            qrl.Add(new QuickReply()
            {
                replacedle = "replacedle 1",
                Payload = "postback#1",
                QuickReplyType = QuickReplyTypes.Text
            });

            qrl.Add(new QuickReply()
            {
                replacedle = "replacedle 2",
                Payload = "postback#2",
                QuickReplyType = QuickReplyTypes.Text
            });

            var result = client.CreateMessageAsync("Broadcast message with quick replies", qrl).Result;
            Trace.WriteLine($"Message Id: {result.Id}");
        }

19 View Source File : BroadcastClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SendMessageTest()
        {
            CreateMessageTest();
            var result = client.BroadcastMessageAsync(message, NotificationTypes.Regular).Result;
            Trace.WriteLine($"Broadcast Id: {result.Id}");
        }

19 View Source File : BroadcastClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void ScheduleMessageTest()
        {
            CreateMessageTest();
            var result = client.BroadcastMessageAsync(message, NotificationTypes.Regular, DateTime.UtcNow.AddMinutes(5)).Result;
            broadcast = result;
            Trace.WriteLine($"Broadcast Id: {result.Id}");
        }

19 View Source File : BroadcastClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void CancelScheduledBroadcastTest()
        {
            ScheduleMessageTest();
            bool result = client.CancelScheduledBroadcast(broadcast).Result;
            Trace.WriteLine($"Canceled: {result}");
        }

19 View Source File : ProfileClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SetStartButtonPostbackTest()
        {
            bool result = client.SetStartButtonPostback("#start_postback#"+DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss")).Result;
            Trace.WriteLine(("Success: {0}".Format(result)));
        }

19 View Source File : ProfileClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SetGreetingTest()
        {
            bool result = client.SetGreeting("Custom Welocome String!").Result;
            Trace.WriteLine(("Success: {0}".Format(result)));
        }

19 View Source File : ProfileClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SetPersistentMenuTest()
        {
            LocalizedMenuItem lmi = new LocalizedMenuItem();
            lmi.Locale = LocalizedMenuItem.DefaultLocale;
            lmi.Items = new List<IMenuItem>();

            NestedMenuItem nested = new NestedMenuItem()
            {
                replacedle = "My Account",
                Items = new List<IMenuItem>()
            };

            nested.Items.Add(new PostbackMenuItem() { replacedle = "Pay Bill", Payload = "PAYBILL_PAYLOAD" });
            nested.Items.Add(new UrlMenuItem() { replacedle = "Latest News", Url = "https://www.messenger.com/" });

            lmi.Items.Add(nested);

            PersistentMenu menu = new PersistentMenu();
            menu.Items = new List<LocalizedMenuItem>();
            menu.Items.Add(lmi);

            bool result = client.SetPersistentMenu(menu).Result;
            Trace.WriteLine(("Success: {0}".Format(result)));
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void ApiUriTest()
        {
            string result = client.ApiUri;
            Trace.WriteLine($"ApiUri: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SendMessageTest()
        {
            string result = client.SendMessageAsync(UserId.ToString(), "Test message").Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SendMessageWithQuickReplyTest()
        {
            List<QuickReply> qrl = new List<QuickReply>();
            qrl.Add(new QuickReply()
            {
                replacedle = "replacedle 1",
                Payload = "postback#1",
                QuickReplyType = QuickReplyTypes.Text
            });

            qrl.Add(new QuickReply()
            {
                replacedle = "replacedle 2",
                Payload = "postback#2",
                QuickReplyType = QuickReplyTypes.Text
            });

            string result = client.SendMessageAsync(UserId.ToString(), "Message with quick replies", qrl).Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void RequestUserLocationTest()
        {
            string result = client.RequestUserLocationAsync(UserId.ToString(), "Your location:").Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void RequestUserPhoneTest()
        {
            string result = client.RequestUserPhoneNumberAsync(UserId.ToString(), "Your Phone Number:").Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void RequestUserEmailTest()
        {
            string result = client.RequestUserEmailAsync(UserId.ToString(), "Your Email:").Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void GenericTemplateTest()
        {
            var buttons = new List<IButton>();
            buttons.Add(new PostbackButton()
            {
                replacedle = "Button 1",
                Payload = "webhook_value_1"
            });

            buttons.Add(new PostbackButton()
            {
                replacedle = "Button 2",
                Payload = "webhook_value_2"
            });

            var defaultAction = new ElementAction()
            {
                Url = "https://m.me/",
            };

            var elements = new List<GenericTemplate.Element>();
            elements.Add(new GenericTemplate.Element()
            {
                replacedle = "replacedle 1",
                Subreplacedle = "Subreplacedle 1",
                ImageUrl = "",
                DefaultAction = defaultAction,
                Buttons = buttons
            });

            elements.Add(new GenericTemplate.Element()
            {
                replacedle = "replacedle 2",
                Subreplacedle = "Subreplacedle 2",
                ImageUrl = "",
                Buttons = buttons
            });

            var attachment = new Attachment<GenericTemplate>()
            {
                Payload = new GenericTemplate()
                {
                    Elements = elements
                }
            };

            //client.SendAttachment<LogInButton>("asd", new LogInButton());

            string result = client.SendAttachment<GenericTemplate>(UserId.ToString(), attachment).Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : SendClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void ListTemplateTest()
        {
            var buttons = new List<IButton>();
            buttons.Add(new PostbackButton()
            {
                replacedle = "Button 1",
                Payload = "webhook_value_1"
            });

            var defaultAction = new ElementAction()
            {
                Url = "https://m.me/",

            };

            var elements = new List<ListTemplate.Element>();
            elements.Add(new ListTemplate.Element()
            {
                replacedle = "replacedle 1",
                Subreplacedle = "Subreplacedle 1",
                ImageUrl = "",
                DefaultAction = defaultAction,
                Buttons = buttons
            });

            elements.Add(new ListTemplate.Element()
            {
                replacedle = "replacedle 2",
                Subreplacedle = "Subreplacedle 2",
                ImageUrl = "",
                Buttons = buttons
            });

            var attachment = new Attachment<ListTemplate>()
            {
                Payload = new ListTemplate()
                {
                    Elements = elements,
                    Buttons = buttons
                }
            };

            string result = client.SendAttachment<ListTemplate>(UserId.ToString(), attachment).Result.Id;
            Trace.WriteLine($"Message Id: {result}");
        }

19 View Source File : DirectMessagesClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void SendMessageTest()
        {
            var result = client.SendMessageAsync(UserId, "test_message").Result;
            Trace.WriteLine($"Message Id: {result.Id}");
        }

19 View Source File : UsersClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void GetUserByIdTest()
        {
            User result = client.GetUserAsync(UserId).Result;
            Trace.WriteLine($"User: {result.ToJson()}");
        }

19 View Source File : UsersClientTests.cs
License : MIT License
Project Creator : 4egod

[TestMethod]
        public void GetUserByNameTest()
        {
            User result = client.GetUserAsync("@4egod").Result;
            Trace.WriteLine($"User: {result.ToJson()}");
        }

19 View Source File : TraceTextWriter.cs
License : MIT License
Project Creator : aabiryukov

public override void WriteLine(string line)
        {
            Trace.WriteLine(line);
        }

19 View Source File : TeamExplorerIntegrator.cs
License : MIT License
Project Creator : aabiryukov

public void DoConnect(TeamFoundationServerExt tfsEx)
		{
			try
			{
				m_tfsExt = tfsEx;

				if (null != m_tfsExt)
				{
					m_tfsExt.ProjectContextChanged += TfsExt_ProjectContextChanged;

					if (null != m_tfsExt.ActiveProjectContext)
					{
						// Run the event handler without the event actually having fired, so we pick up the initial state. 
						TfsExt_ProjectContextChanged(null, EventArgs.Empty);
					}
				}
			}
			catch (Exception ex)
			{
				Trace.WriteLine("[TfsVisualHistory][DoConnect] " + ex.Message);
				////MessageBox.Show(ex.Message); 
			}
		}

19 View Source File : Program.cs
License : MIT License
Project Creator : ab4d

public static void WriteErrorDetails(OvrWrap OVR, Result result, string message)
		{
			if(result >= Result.Success)
				return;

			// Retrieve the error message from the last occurring error.
			ErrorInfo errorInformation = OVR.GetLastErrorInfo();

			string formattedMessage = string.Format("{0}. \nMessage: {1} (Error code={2})", message, errorInformation.ErrorString, errorInformation.Result);
			Trace.WriteLine(formattedMessage);
			MessageBox.Show(formattedMessage, message);

			throw new Exception(formattedMessage);
		}

19 View Source File : OvrWarpDX11Test.cs
License : MIT License
Project Creator : ab4d

protected void LogCallback(IntPtr userData, LogLevel level, string message)
        {
            string formattedMessage = string.Format("[{0}] {1}", level.ToString(), message);
            System.Diagnostics.Trace.WriteLine(formattedMessage);
        }

19 View Source File : UserAgentUtility.cs
License : MIT License
Project Creator : actions

private static List<ProductInfoHeaderValue> ConstructDefaultRestUserAgent()
        {
            // Pick up the replacedembly version from this dll
            String fileVersion = "unavailable";
            try
            {
                replacedemblyFileVersionAttribute attr = typeof(UserAgentUtility).GetTypeInfo().replacedembly.GetCustomAttribute<replacedemblyFileVersionAttribute>();
                if (attr != null)
                {
                    fileVersion = attr.Version;
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine("DefaultUserAgent: Unable to get fileVersion: " + e.ToString());
            }

            String commentValue = string.Format("(NetStandard; {0})", RuntimeInformation.OSDescription.Replace('(', '[').Replace(')', ']').Trim());

            return new List<ProductInfoHeaderValue> {
                new ProductInfoHeaderValue("VSServices", fileVersion),
                new ProductInfoHeaderValue(commentValue) };
        }

19 View Source File : NumericsForm.cs
License : MIT License
Project Creator : adospace

protected override void OnMounted()
        {
            System.Diagnostics.Trace.WriteLine($"{GetType()} Mounted");
            base.OnMounted();
        }

19 View Source File : NumericsForm.cs
License : MIT License
Project Creator : adospace

protected override void OnWillUnmount()
        {
            System.Diagnostics.Trace.WriteLine($"{GetType()} Will unmount");
            base.OnWillUnmount();
        }

19 View Source File : SqliteDataBase.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

public void Open()
        {
            if (Connection == null || Connection.State != ConnectionState.Open)
            {
                Trace.WriteLine(Thread.CurrentThread.ManagedThreadId);
                Trace.WriteLine("Open Database");
                Connection = new SQLiteConnection(this.ConnectionString);
                Connection.Open();
                QuoteCount = short.MaxValue;
            }
            QuoteCount += 1;
        }

19 View Source File : SqliteDataBase.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

public void Close()
        {
            if (Connection == null)
                return;
            if (Connection.State != ConnectionState.Open)
                Connection.Close();
            Connection = null;

            Trace.WriteLine(Thread.CurrentThread.ManagedThreadId);
            Trace.WriteLine("Close Database");
        }

19 View Source File : DebuggingSample.cs
License : The Unlicense
Project Creator : ahotko

public void ImmediateWindowMessages()
        {
            Trace.WriteLine("Some Trace messages to follow:");
            Trace.IndentSize = 2;
            Trace.Indent();
            Trace.TraceInformation("This is Trace information.");
            Trace.Indent();
            Trace.TraceInformation("This is Trace information - indented.");
            Trace.Unindent();
            Trace.TraceWarning("This is Trace Warning.");
            Trace.TraceError("This is Trace Error.");
            Trace.Unindent();
            Trace.Flush();
            //
            Debug.WriteLine("This is Debug Line.");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateIntegersAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateIntegersAsync(2, 0, 9, false).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]}");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateIntegerSequencesAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateIntegerSequencesAsync(new[] { 2, 2 }, new[] { 0, 0 }, new[] { 9, 9 }, new[] { false, false }).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0.0: {result.Random.Data[0][0]}");
            Trace.WriteLine($"result.random.data.0.1: {result.Random.Data[0][1]}");
            Trace.WriteLine($"result.random.data.1.0: {result.Random.Data[1][0]}");
            Trace.WriteLine($"result.random.data.1.1: {result.Random.Data[1][1]}");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateStringsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateStringsAsync(2, 2, "abcdef", false).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);
            replacedert.IsNotNull(result.Random.Data[0]);
            replacedert.IsNotNull(result.Random.Data[1]);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedStringsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedStringsAsync(2, 2, "abcdef", false).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);
            replacedert.IsNotNull(result.Random.Data[0]);
            replacedert.IsNotNull(result.Random.Data[1]);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedUuidsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedUuidsAsync(2).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]}");
        }

19 View Source File : RandomOrgClientTests.Internal.cs
License : MIT License
Project Creator : alexanderkozlenko

private static void TraceRandomResult<T>(RandomResult<T> result)
        {
            Trace.WriteLine($"result.bits_used: {result.BitsUsed}");
            Trace.WriteLine($"result.bits_left: {result.BitsLeft}");
            Trace.WriteLine($"result.requests_left: {result.RequestsLeft}");
            Trace.WriteLine($"result.advisory_delay: {result.AdvisoryDelay}");
            Trace.WriteLine($"result.random.completion_time: {result.Random.CompletionTime:yyyy.MM.dd-HH:mm:ss.ffff}");
        }

19 View Source File : RandomOrgClientTests.Internal.cs
License : MIT License
Project Creator : alexanderkozlenko

private static void TraceSignedRandomResult<TValue, TParameters>(SignedRandomResult<TValue, TParameters> result)
            where TParameters : RandomParameters, new()
        {
            var signature = result.GetSignature();

            Trace.WriteLine($"result.signature: {BitConverter.ToString(signature).Replace("-", string.Empty)}");
            Trace.WriteLine($"result.bits_used: {result.BitsUsed}");
            Trace.WriteLine($"result.bits_left: {result.BitsLeft}");
            Trace.WriteLine($"result.requests_left: {result.RequestsLeft}");
            Trace.WriteLine($"result.advisory_delay: {result.AdvisoryDelay}");
            Trace.WriteLine($"result.random.completion_time: {result.Random.CompletionTime:yyyy.MM.dd-HH:mm:ss.ffff}");
        }

19 View Source File : RandomOrgClientTests.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GetUsageAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GetUsageAsync().ConfigureAwait(false);

            replacedert.IsNotNull(result);

            Trace.WriteLine($"result.status: {result.Status}");
            Trace.WriteLine($"result.bits_left: {result.BitsLeft}");
            Trace.WriteLine($"result.requests_left: {result.RequestsLeft}");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateBlobsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateBlobsAsync(2, 2).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);
            replacedert.IsNotNull(result.Random.Data[0]);
            replacedert.IsNotNull(result.Random.Data[1]);
            replacedert.AreEqual(2, result.Random.Data[0].Length);
            replacedert.AreEqual(2, result.Random.Data[1].Length);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {BitConverter.ToString(result.Random.Data[0])}");
            Trace.WriteLine($"result.random.data.1: {BitConverter.ToString(result.Random.Data[1])}");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateDecimalFractionsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateDecimalFractionsAsync(2, 2, false).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]:N2}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]:N2}");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateGaussiansAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateGaussiansAsync(2, 0.0m, 1.0m, 2).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]:N2}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]:N2}");
        }

19 View Source File : RandomOrgClientTests.Generate.Basic.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateUuidsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateUuidsAsync(2).ConfigureAwait(false);

            replacedertRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedBlobsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedBlobsAsync(2, 2).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);
            replacedert.IsNotNull(result.Random.Data[0]);
            replacedert.IsNotNull(result.Random.Data[1]);
            replacedert.AreEqual(2, result.Random.Data[0].Length);
            replacedert.AreEqual(2, result.Random.Data[1].Length);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {BitConverter.ToString(result.Random.Data[0])}");
            Trace.WriteLine($"result.random.data.1: {BitConverter.ToString(result.Random.Data[1])}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedDecimalFractionsAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedDecimalFractionsAsync(2, 2, false).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]:N2}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]:N2}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedGaussiansAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedGaussiansAsync(2, 0.0m, 1.0m, 2).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]:N2}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]:N2}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedIntegersAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedIntegersAsync(2, 0, 9, false).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0: {result.Random.Data[0]}");
            Trace.WriteLine($"result.random.data.1: {result.Random.Data[1]}");
        }

19 View Source File : RandomOrgClientTests.Generate.Signed.cs
License : MIT License
Project Creator : alexanderkozlenko

[TestMethod]
        public async Task GenerateSignedIntegerSequencesAsync()
        {
            using var client = new RandomOrgClient(GetServiceApiKey());

            var result = await client.GenerateSignedIntegerSequencesAsync(new[] { 2, 2 }, new[] { 0, 0 }, new[] { 9, 9 }, new[] { false, false }).ConfigureAwait(false);

            replacedertSignedRandomResult(result);

            replacedert.AreEqual(2, result.Random.Data.Count);

            TraceSignedRandomResult(result);

            Trace.WriteLine($"result.random.data.0.0: {result.Random.Data[0][0]}");
            Trace.WriteLine($"result.random.data.0.1: {result.Random.Data[0][1]}");
            Trace.WriteLine($"result.random.data.1.0: {result.Random.Data[1][0]}");
            Trace.WriteLine($"result.random.data.1.1: {result.Random.Data[1][1]}");
        }

See More Examples