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


C# Pubnub.AuditAccess方法代码示例

本文整理汇总了C#中Pubnub.AuditAccess方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.AuditAccess方法的具体用法?C# Pubnub.AuditAccess怎么用?C# Pubnub.AuditAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pubnub的用法示例。


在下文中一共展示了Pubnub.AuditAccess方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThenSubKeyLevelShouldReturnSuccess

        public void ThenSubKeyLevelShouldReturnSuccess()
        {
            receivedAuditMessage = false;

            currentUnitTestCase = "ThenSubKeyLevelShouldReturnSuccess";
            mreAudit = new ManualResetEvent(false);

            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenAuditIsRequested";
                    unitTest.TestCaseName = "ThenSubKeyLevelShouldReturnSuccess";
                    pubnub.PubnubUnitTest = unitTest;
                    if (PubnubCommon.PAMEnabled)
                    {
                        EnqueueCallback(() => pubnub.AuditAccess<string>(AccessToSubKeyLevelCallback, DummyErrorCallback));
                        mreAudit.WaitOne(310 * 1000);

                        EnqueueCallback(() => Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenSubKeyLevelShouldReturnSuccess failed."));
                    }
                    else
                    {
                        EnqueueCallback(() => Assert.Inconclusive("PAM Not Enabled for WhenAuditIsRequested -> ThenSubKeyLevelShouldReturnSuccess"));
                    }
                    EnqueueTestComplete();
                });
        }
开发者ID:jugalkishor-sujal,项目名称:c-sharp,代码行数:29,代码来源:WhenAuditIsRequested.cs

示例2: ThenChannelLevelShouldReturnSuccess

        public void ThenChannelLevelShouldReturnSuccess()
        {
            currentUnitTestCase = "ThenChannelLevelShouldReturnSuccess";

            receivedAuditMessage = false;

            ThreadPool.QueueUserWorkItem((s) =>
                {
                    Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

                    PubnubUnitTest unitTest = new PubnubUnitTest();
                    unitTest.TestClassName = "WhenAuditIsRequested";
                    unitTest.TestCaseName = "ThenChannelLevelShouldReturnSuccess";
                    pubnub.PubnubUnitTest = unitTest;

                    string channel = "hello_my_channel";

                    if (PubnubCommon.PAMEnabled)
                    {
                        mreAudit = new ManualResetEvent(false);
                        pubnub.AuditAccess<string>(channel, AccessToChannelLevelCallback, DummyErrorCallback);
                        mreAudit.WaitOne(60 * 1000);

                        Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess failed.");
                    }
                    else
                    {
                        Assert.Inconclusive("PAM Not Enabled for WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess");
                    }
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        TestComplete();
                    });
                });
        }
开发者ID:jdstroy,项目名称:c-sharp,代码行数:35,代码来源:WhenAuditIsRequested.cs

示例3: ThenChannelLevelShouldReturnSuccess

        public void ThenChannelLevelShouldReturnSuccess()
        {
            currentUnitTestCase = "ThenChannelLevelShouldReturnSuccess";

            receivedAuditMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAuditIsRequested";
            unitTest.TestCaseName = "ThenChannelLevelShouldReturnSuccess";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            if (PubnubCommon.PAMEnabled)
            {
                auditManualEvent = new ManualResetEvent(false);
                pubnub.AuditAccess<string>(channel, AccessToChannelLevelCallback, DummyErrorCallback);
                Task.Delay(1000);

                auditManualEvent.WaitOne();

                pubnub.PubnubUnitTest = null;
                pubnub = null;
                Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess failed.");
            }
            else
            {
                Assert.Inconclusive("PAM Not Enabled for WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess");
            }
        }
开发者ID:pubnub,项目名称:c-sharp,代码行数:32,代码来源:WhenAuditIsRequested.cs

示例4: ThenSubKeyLevelShouldReturnSuccess

        public void ThenSubKeyLevelShouldReturnSuccess()
        {
            currentUnitTestCase = "ThenSubKeyLevelShouldReturnSuccess";

            receivedAuditMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAuditIsRequested";
            unitTest.TestCaseName = "ThenSubKeyLevelShouldReturnSuccess";
            pubnub.PubnubUnitTest = unitTest;
            if (PubnubCommon.PAMEnabled)
                {
                    pubnub.AuditAccess<string>(AccessToSubKeyLevelCallback, DummyErrorCallback);
                    Thread.Sleep(1000);

                    auditManualEvent.WaitOne();

                    Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenSubKeyLevelShouldReturnSuccess failed.");
                } else
                {
                    Assert.Ignore("PAM Not Enabled for WhenAuditIsRequested -> ThenSubKeyLevelShouldReturnSuccess");
                }

        }
开发者ID:jugalkishor-sujal,项目名称:c-sharp,代码行数:26,代码来源:WhenAuditIsRequested.cs

示例5: AtChannelLevel

        public void AtChannelLevel()
        {
            if (!PubnubCommon.PAMEnabled)
            {
                Assert.Ignore("PAM not enabled; CleanupGrant -> AtChannelLevel.");
                return;
            }

            if (!PubnubCommon.EnableStubTest)
            {
                receivedAuditMessage = false;
                auditManualEvent = new ManualResetEvent(false);

                pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);
                pubnub.AuditAccess<string>(UserCallbackForCleanUpAccessAtChannelLevel, ErrorCallbackForCleanUpAccessAtChannelLevel);
                auditManualEvent.WaitOne();

                pubnub.EndPendingRequests();
                pubnub = null;
                Assert.IsTrue(receivedAuditMessage, "CleanupGrant -> AtChannelLevel failed.");
            }
            else
            {
                Assert.Ignore("Only for live test; CleanupGrant -> AtChannelLevel.");
            }
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:26,代码来源:CleanupGrant.cs

示例6: ThenChannelLevelShouldReturnSuccess

        public void ThenChannelLevelShouldReturnSuccess()
        {
			Debug.Log("Running ThenChannelLevelShouldReturnSuccess()");
            currentUnitTestCase = "ThenChannelLevelShouldReturnSuccess";

            receivedAuditMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAuditIsRequested";
            unitTest.TestCaseName = "ThenChannelLevelShouldReturnSuccess";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            if (PubnubCommon.PAMEnabled)
            {
                pubnub.AuditAccess<string>(channel, AccessToChannelLevelCallback, DummyErrorCallback);
                Thread.Sleep(1000);

                auditManualEvent.WaitOne();

                UUnitAssert.True(receivedAuditMessage, "WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess failed.");
            }
            else
            {
                UUnitAssert.False(true,"PAM Not Enabled for WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess");
            }
        }
开发者ID:TharinduMunasinge,项目名称:c-sharp,代码行数:30,代码来源:WhenAuditIsRequested.cs

示例7: ThenChannelLevelShouldReturnSuccess

        public void ThenChannelLevelShouldReturnSuccess()
        {
            auditAccessCallbackInvoked = false;

            currentUnitTestCase = "ThenChannelLevelShouldReturnSuccess";

            receivedAuditMessage = false;

            Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

            PubnubUnitTest unitTest = new PubnubUnitTest();
            unitTest.TestClassName = "WhenAuditIsRequested";
            unitTest.TestCaseName = "ThenChannelLevelShouldReturnSuccess";
            pubnub.PubnubUnitTest = unitTest;

            string channel = "hello_my_channel";

            if (PubnubCommon.PAMEnabled)
            {
                EnqueueCallback(() => pubnub.AuditAccess<string>(channel, AccessToChannelLevelCallback, DummyErrorCallback));
                //Thread.Sleep(1000);
                EnqueueConditional(() => auditAccessCallbackInvoked);
                EnqueueCallback(() => Assert.IsTrue(receivedAuditMessage, "WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess failed."));
            }
            else
            {
                EnqueueCallback(() => Assert.Inconclusive("PAM Not Enabled for WhenAuditIsRequested -> ThenChannelLevelShouldReturnSuccess"));
            }
            EnqueueTestComplete();
        }
开发者ID:Evgeniy20,项目名称:c-sharp,代码行数:30,代码来源:WhenAuditIsRequested.cs

示例8: AtChannelLevel

        public void AtChannelLevel ()
        {
            if (!PubnubCommon.EnableStubTest) {
                receivedAuditMessage = false;

                Pubnub pubnub = new Pubnub (PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);
                pubnub.AuditAccess<string> (UserCallbackForCleanUpAccessAtChannelLevel, ErrorCallbackForCleanUpAccessAtChannelLevel);
                auditManualEvent.WaitOne ();

                Assert.True (receivedAuditMessage, "CleanupGrant -> AtChannelLevel failed.");
            } else {
                Assert.Ignore ("Only for live test; CleanupGrant -> AtChannelLevel.");
            }
        }
开发者ID:hakangs,项目名称:c-sharp,代码行数:14,代码来源:CleanupGrant.cs

示例9: Main


//.........这里部分代码省略.........

                        if (channel.Trim().Length <= 0)
                        {
                            Console.WriteLine("Enter CHANNEL GROUP name for PAM Audit.");
                            channelGroup = Console.ReadLine();
                        }
                        if (channel.Trim().Length <= 0 && channelGroup.Trim().Length <= 0)
                        {
                            Console.WriteLine("Channel or ChannelGroup not provided. Please try again.");
                            break;
                        }

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}", channel));
                        Console.ResetColor();
                        Console.WriteLine();
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("ChannelGroup = {0}", channelGroup));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Enter the auth_key for PAM Audit (optional)");
                        Console.WriteLine("Press Enter Key if there is no auth_key at this time.");
                        string authAudit = Console.ReadLine();
                        
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("auth_key = {0}", authAudit));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Running PamAudit()");
                        if (channel.Trim().Length > 0)
                        {
                            pubnub.AuditAccess<string>(channel, authAudit, DisplayReturnMessage, DisplayErrorMessage);
                        }
                        else
                        {
                            pubnub.ChannelGroupAuditAccess<string>(channelGroup, authAudit, DisplayReturnMessage, DisplayErrorMessage);
                        }
                        break;
                    case "14":
                        Console.WriteLine("Enter CHANNEL name for PAM Revoke");
                        Console.WriteLine("To enter CHANNEL GROUP name, just hit ENTER");
                        channel = Console.ReadLine();
                        
                        if (channel.Trim().Length <= 0)
                        {
                            Console.WriteLine("Enter CHANNEL GROUP name for PAM Revoke.");
                            channelGroup = Console.ReadLine();
                        }
                        if (channel.Trim().Length <= 0 && channelGroup.Trim().Length <= 0)
                        {
                            channel = "";
                            Console.WriteLine("Channel or ChannelGroup not provided. Please try again.");
                            break;
                        }
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}", channel));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("ChannelGroup = {0}", channelGroup));
                        Console.ResetColor();
                        Console.WriteLine();
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:66,代码来源:PubnubExample.cs

示例10: Main


//.........这里部分代码省略.........
                        string readAccess = Console.ReadLine();
                        bool read = (readAccess.ToLower() == "n") ? false : true;
                        Console.WriteLine("Write Access? Enter Y for Yes (default), N for No.");
                        string writeAccess = Console.ReadLine();
                        bool write = (writeAccess.ToLower() == "n") ? false : true;
                        Console.WriteLine("How many minutes do you want to allow Grant Access? Enter the number of minutes.");
                        Console.WriteLine("Default = 1440 minutes (24 hours). Press ENTER now to accept default value.");
                        string grantTimeLimit = Console.ReadLine();
                        int grantTimeLimitInSeconds;
                        Int32.TryParse(grantTimeLimit, out grantTimeLimitInSeconds);
                        if (grantTimeLimitInSeconds == 0) grantTimeLimitInSeconds = 1440;

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}",channel));
                        Console.WriteLine(string.Format("Read Access = {0}", read.ToString()));
                        Console.WriteLine(string.Format("Write Access = {0}", write.ToString()));
                        Console.WriteLine(string.Format("Grant Access Time Limit = {0}", grantTimeLimitInSeconds.ToString()));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Running PamGrant()");
                        pubnub.GrantAccess<string>(channel, read, write, grantTimeLimitInSeconds, DisplayReturnMessage, DisplayErrorMessage);
                        break;
                    case "13":
                        Console.WriteLine("Enter CHANNEL name for PAM Audit");
                        channel = Console.ReadLine();

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}", channel));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Running PamAudit()");
                        pubnub.AuditAccess<string>(channel,DisplayReturnMessage, DisplayErrorMessage);
                        break;
                    case "14":
                        Console.WriteLine("Enter CHANNEL name for PAM Revoke");
                        channel = Console.ReadLine();

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}", channel));
                        Console.ResetColor();
                        Console.WriteLine();

                        Console.WriteLine("Running PamRevoke()");
                        pubnub.GrantAccess<string>(channel, false,false, DisplayReturnMessage, DisplayErrorMessage);
                        break;
                    case "15":
                        Console.WriteLine("Enter CHANNEL name for PAM Grant Presence.");
                        channel = Console.ReadLine();
                        Console.WriteLine("Read Access? Enter Y for Yes (default), N for No.");
                        string readPresenceAccess = Console.ReadLine();
                        bool readPresence = (readPresenceAccess.ToLower() == "n") ? false : true;
                        Console.WriteLine("Write Access? Enter Y for Yes (default), N for No.");
                        string writePresenceAccess = Console.ReadLine();
                        bool writePresence = (writePresenceAccess.ToLower() == "n") ? false : true;
                        Console.WriteLine("How many minutes do you want to allow Grant Presence Access? Enter the number of minutes.");
                        Console.WriteLine("Default = 1440 minutes (24 hours). Press ENTER now to accept default value.");
                        string grantPresenceTimeLimit = Console.ReadLine();
                        int grantPresenceTimeLimitInSeconds;
                        Int32.TryParse(grantPresenceTimeLimit, out grantPresenceTimeLimitInSeconds);
                        if (grantPresenceTimeLimitInSeconds == 0) grantTimeLimitInSeconds = 1440;

                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.WriteLine(string.Format("Channel = {0}", channel));
                        Console.WriteLine(string.Format("Read Access = {0}", readPresence.ToString()));
开发者ID:TharinduMunasinge,项目名称:c-sharp,代码行数:67,代码来源:PubnubExample.cs

示例11: Main


//.........这里部分代码省略.........
					bool read = (readAccess.ToLower () == "n") ? false : true;
					Console.WriteLine ("Write Access? Enter Y for Yes (default), N for No.");
					string writeAccess = Console.ReadLine ();
					bool write = (writeAccess.ToLower () == "n") ? false : true;
					Console.WriteLine ("How many minutes do you want to allow Grant Access? Enter the number of minutes.");
					Console.WriteLine ("Default = 1440 minutes (24 hours). Press ENTER now to accept default value.");
					string grantTimeLimit = Console.ReadLine ();
					int grantTimeLimitInSeconds;
					Int32.TryParse (grantTimeLimit, out grantTimeLimitInSeconds);
					if (grantTimeLimitInSeconds == 0)
						grantTimeLimitInSeconds = 1440;

					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Channel = {0}", channel));
					Console.WriteLine (string.Format ("Read Access = {0}", read.ToString ()));
					Console.WriteLine (string.Format ("Write Access = {0}", write.ToString ()));
					Console.WriteLine (string.Format ("Grant Access Time Limit = {0}", grantTimeLimitInSeconds.ToString ()));
					Console.ResetColor ();
					Console.WriteLine ();

					Console.WriteLine ("Running PamGrant()");
					pubnub.GrantAccess<string> (channel, read, write, grantTimeLimitInSeconds, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "13":
					Console.WriteLine ("Enter CHANNEL name for PAM Audit");
					channel = Console.ReadLine ();

					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Channel = {0}", channel));
					Console.ResetColor ();
					Console.WriteLine ();

					Console.WriteLine ("Running PamAudit()");
					pubnub.AuditAccess<string> (channel, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "14":
					Console.WriteLine ("Enter CHANNEL name for PAM Revoke");
					channel = Console.ReadLine ();

					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Channel = {0}", channel));
					Console.ResetColor ();
					Console.WriteLine ();

					Console.WriteLine ("Running PamRevoke()");
					pubnub.GrantAccess<string> (channel, false, false, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "15":
					Console.WriteLine ("Enter CHANNEL name for PAM Grant Presence.");
					channel = Console.ReadLine ();
					Console.WriteLine ("Read Access? Enter Y for Yes (default), N for No.");
					string readPresenceAccess = Console.ReadLine ();
					bool readPresence = (readPresenceAccess.ToLower () == "n") ? false : true;
					Console.WriteLine ("Write Access? Enter Y for Yes (default), N for No.");
					string writePresenceAccess = Console.ReadLine ();
					bool writePresence = (writePresenceAccess.ToLower () == "n") ? false : true;
					Console.WriteLine ("How many minutes do you want to allow Grant Presence Access? Enter the number of minutes.");
					Console.WriteLine ("Default = 1440 minutes (24 hours). Press ENTER now to accept default value.");
					string grantPresenceTimeLimit = Console.ReadLine ();
					int grantPresenceTimeLimitInSeconds;
					Int32.TryParse (grantPresenceTimeLimit, out grantPresenceTimeLimitInSeconds);
					if (grantPresenceTimeLimitInSeconds == 0)
						grantPresenceTimeLimitInSeconds = 1440;

					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine (string.Format ("Channel = {0}", channel));
开发者ID:jugalkishor-sujal,项目名称:c-sharp,代码行数:67,代码来源:PubnubExample.cs


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