• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TestClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TestClient的典型用法代码示例。如果您正苦于以下问题:C# TestClient类的具体用法?C# TestClient怎么用?C# TestClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestClient类属于命名空间,在下文中一共展示了TestClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetupInformClientOfNeighbourTriggersNeighbourClientCreate

        /// <summary>
        /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the
        /// viewer to setup a connection with the destination region.
        /// </summary>
        /// <param name='tc'></param>
        /// <param name='neighbourTcs'>
        /// A list that will be populated with any TestClients set up in response to 
        /// being informed about a destination region.
        /// </param>
        public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate(
            TestClient tc, List<TestClient> neighbourTcs)
        {
            // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the
            // event queue).

            tc.OnTestClientInformClientOfNeighbour += (neighbourHandle, neighbourExternalEndPoint) =>
            {
                uint x, y;
                Utils.LongToUInts(neighbourHandle, out x, out y);
                x /= Constants.RegionSize;
                y /= Constants.RegionSize;

                m_log.DebugFormat(
                    "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", 
                    x, y, neighbourExternalEndPoint);

                AgentCircuitData newAgent = tc.RequestClientInfo();

                Scene neighbourScene;
                SceneManager.Instance.TryGetScene(x, y, out neighbourScene);

                TestClient neighbourTc = new TestClient(newAgent, neighbourScene);
                neighbourTcs.Add(neighbourTc);
                neighbourScene.AddNewAgent(neighbourTc, PresenceType.User);
            };
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:36,代码来源:EntityTransferHelpers.cs


示例2: FlyToCommand

 public FlyToCommand(TestClient Client)
 {
     Name = "FlyTo";
     Description = "Fly the avatar toward the specified position for a maximum of seconds. Usage: FlyTo x y z [seconds]";
     Category = CommandCategory.Movement;
     Client.Objects.TerseObjectUpdate += Objects_OnObjectUpdated;            
 }
开发者ID:Vinhold,项目名称:halcyon,代码行数:7,代码来源:FlyToCommand.cs


示例3: ValidHelloMessage

        public void ValidHelloMessage ()
        {
            var responseStream = new MemoryStream ();
            var stream = new TestStream (new MemoryStream (helloMessage), responseStream);

            // Create mock byte server and client
            var mockByteServer = new Mock<IServer<byte,byte>> ();
            var byteServer = mockByteServer.Object;
            var byteClient = new TestClient (stream);

            var server = new RPCServer (byteServer);
            server.OnClientRequestingConnection += (sender, e) => e.Request.Allow ();
            server.Start ();

            // Fire a client connection event
            var eventArgs = new ClientRequestingConnectionEventArgs<byte,byte> (byteClient);
            mockByteServer.Raise (m => m.OnClientRequestingConnection += null, eventArgs);

            Assert.IsTrue (eventArgs.Request.ShouldAllow);
            Assert.IsFalse (eventArgs.Request.ShouldDeny);

            server.Update ();
            Assert.AreEqual (1, server.Clients.Count ());
            Assert.AreEqual ("Jebediah Kerman!!!", server.Clients.First ().Name);

            byte[] bytes = responseStream.ToArray ();
            byte[] responseBytes = byteClient.Guid.ToByteArray ();
            Assert.IsTrue (responseBytes.SequenceEqual (bytes));
        }
开发者ID:paperclip,项目名称:krpc,代码行数:29,代码来源:RPCServerTest.cs


示例4: GoodDownload

        public void GoodDownload()
        {
            var res = new MockResponse()
            {
                ContentType = "text/plain",
                Code = System.Net.HttpStatusCode.OK,
                Body = "test,report"
            };

            using (var c = new TestClient(res))
            {
                var actualResult = c.Client.Export.Download(123);

                // test the request
                var queryString = c.Request.QueryString;
                GeneralClient.TestRequiredParameters(queryString);

                queryString.ContainsAndEquals("token", "123");

                Assert.IsFalse(actualResult.Pending);
                Assert.IsNotNull(actualResult.ExportStream);

                var actualReport = String.Empty;
                using (StreamReader reader = new StreamReader(actualResult.ExportStream, Encoding.UTF8))
                {
                    actualReport = reader.ReadToEnd();
                }

                Assert.AreEqual("test,report", actualReport);
            }
        }
开发者ID:ryanlsmith,项目名称:api-csharp,代码行数:31,代码来源:Download.cs


示例5: InPacketTest

        /// <summary>
        /// More a placeholder, really
        /// </summary>        
        public void InPacketTest()
        {
            TestHelper.InMethod();

            AgentCircuitData agent = new AgentCircuitData();
            agent.AgentID = UUID.Random();
            agent.firstname = "testfirstname";
            agent.lastname = "testlastname";
            agent.SessionID = UUID.Zero;
            agent.SecureSessionID = UUID.Zero;
            agent.circuitcode = 123;
            agent.BaseFolder = UUID.Zero;
            agent.InventoryFolder = UUID.Zero;
            agent.startpos = Vector3.Zero;
            agent.CapsPath = "http://wibble.com";
            
            TestLLUDPServer testLLUDPServer;
            TestLLPacketServer testLLPacketServer;
            AgentCircuitManager acm;
            IScene scene = new MockScene();
            SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
            
            TestClient testClient = new TestClient(agent, scene);
            
            ILLPacketHandler packetHandler 
                = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
            
            packetHandler.InPacket(new AgentAnimationPacket());
            LLQueItem receivedPacket = packetHandler.PacketQueue.Dequeue();
            
            Assert.That(receivedPacket, Is.Not.Null);
            Assert.That(receivedPacket.Incoming, Is.True);
            Assert.That(receivedPacket.Packet, Is.TypeOf(typeof(AgentAnimationPacket)));
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:37,代码来源:PacketHandlerTests.cs


示例6: Given

 protected override void Given()
 {
     var approvedEntitiesCache = new ApprovedEntitiesCache();
     var eventProcessorCache = PreProcessorHelper.CreateEventProcessorCache();
     _testClient1 = new DomainRepository(new AggregateRootFactory(eventProcessorCache, approvedEntitiesCache)).CreateNew<TestClient>();
     _testClient2 = new DomainRepository(new AggregateRootFactory(eventProcessorCache, approvedEntitiesCache)).CreateNew<TestClient>();
 }
开发者ID:RobinLaerm,项目名称:Fohjin,代码行数:7,代码来源:When_instantiating_two_of_the_same_aggregate_roots_it_will_wire_the_events_correctly_without_mixing_them_together.cs


示例7: BadRequest

        public void BadRequest()
        {
            var res = new MockResponse()
            {
                ContentType = "application/json",
                Code = System.Net.HttpStatusCode.NotFound,
                Body = @"{ ""message"": ""Invalid Format"" }"
            };

            using (var c = new TestClient(res))
            {
                try
                {
                    c.Client.Export.Request("test", SlideRoom.API.Resources.RequestFormat.Csv);
                    Assert.Fail("should throw an exception");
                }
                catch (SlideRoom.API.SlideRoomAPIException e)
                {
                    Assert.AreEqual("Invalid Format", e.Message);
                    Assert.AreEqual(System.Net.HttpStatusCode.NotFound, e.StatusCode);
                }
                catch
                {
                    Assert.Fail("should throw a SlideRoomAPIException");
                }
            }
        }
开发者ID:slideroom,项目名称:api-csharp,代码行数:27,代码来源:Request.cs


示例8: GoodRequest

        public void GoodRequest()
        {
            var res = new MockResponse()
            {
                ContentType = "application/json",
                Code = System.Net.HttpStatusCode.OK,
                Body = @"{ ""token"": 123, ""submissions"": 456, ""message"": ""test""}"
            };

            using (var c = new TestClient(res))
            {
                var actualResult = c.Client.Export.Request("test", SlideRoom.API.Resources.RequestFormat.Csv);

                // test the request
                var queryString = c.Request.QueryString;
                GeneralClient.TestRequiredParameters(queryString);

                queryString.ContainsAndEquals("export", "test");
                queryString.ContainsAndEquals("format", "csv");
                queryString.NotContains("ss");
                queryString.NotContains("since");

                var expectedResult = new SlideRoom.API.Resources.RequestResult()
                {
                    Message = "test",
                    Submissions = 456,
                    Token = 123
                };

                Assert.AreEqual(expectedResult.Message, actualResult.Message);
                Assert.AreEqual(expectedResult.Submissions, actualResult.Submissions);
                Assert.AreEqual(expectedResult.Token, actualResult.Token);
            }
        }
开发者ID:slideroom,项目名称:api-csharp,代码行数:34,代码来源:Request.cs


示例9: SetUpInformClientOfNeighbour

        /// <summary>
        /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the
        /// viewer to setup a connection with the destination region.
        /// </summary>
        /// <param name='tc'></param>
        /// <param name='neighbourTcs'>
        /// A list that will be populated with any TestClients set up in response to 
        /// being informed about a destination region.
        /// </param>
        public static void SetUpInformClientOfNeighbour(TestClient tc, List<TestClient> neighbourTcs)
        {
            // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the
            // event queue).

            tc.OnTestClientInformClientOfNeighbour += (neighbourHandle, neighbourExternalEndPoint) =>
            {
                uint x, y;
                Utils.LongToUInts(neighbourHandle, out x, out y);
                x /= Constants.RegionSize;
                y /= Constants.RegionSize;

                m_log.DebugFormat(
                    "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", 
                    x, y, neighbourExternalEndPoint);

                // In response to this message, we are going to make a teleport to the scene we've previous been told
                // about by test code (this needs to be improved).
                AgentCircuitData newAgent = tc.RequestClientInfo();

                Scene neighbourScene;
                SceneManager.Instance.TryGetScene(x, y, out neighbourScene);

                TestClient neighbourTc = new TestClient(newAgent, neighbourScene);
                neighbourTcs.Add(neighbourTc);
                neighbourScene.AddNewClient(neighbourTc, PresenceType.User);
            };
        }
开发者ID:hippie-b,项目名称:opensim,代码行数:37,代码来源:EntityTransferHelpers.cs


示例10: DisposeDoesNothingWhenNotLoggedIn

 public void DisposeDoesNothingWhenNotLoggedIn()
 {
     var client = new TestClient();
     Assert.IsFalse(client.LoggedOut);
     client.Dispose();
     Assert.IsFalse(client.LoggedOut);
 }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:7,代码来源:CruiseServerClientBaseTests.cs


示例11: BadDownload

        public void BadDownload()
        {
            var res = new MockResponse()
            {
                ContentType = "application/json",
                Code = System.Net.HttpStatusCode.Gone,
                Body = @"{ ""message"": ""Export no longer available."" }"
            };

            using (var c = new TestClient(res))
            {
                try
                {
                    c.Client.Export.Download(123);
                    Assert.Fail("should throw an exception");
                }
                catch (SlideRoom.API.SlideRoomAPIException e)
                {
                    Assert.AreEqual("Export no longer available.", e.Message);
                    Assert.AreEqual(System.Net.HttpStatusCode.Gone, e.StatusCode);
                }
                catch
                {
                    Assert.Fail("should throw a SlideRoomAPIException");
                }
            }
        }
开发者ID:ryanlsmith,项目名称:api-csharp,代码行数:27,代码来源:Download.cs


示例12: FlyToCommand

        public FlyToCommand(TestClient client)
        {
            Name = "FlyTo";
            Description = "Fly the avatar toward the specified position for a maximum of seconds. Usage: FlyTo x y z [seconds]";
            Category = CommandCategory.Movement;

            client.Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated);
        }
开发者ID:3di,项目名称:3di-viewer-rei-libs,代码行数:8,代码来源:FlyToCommand.cs


示例13: DisposeLogsOutWhenLoggedIn

 public void DisposeLogsOutWhenLoggedIn()
 {
     var client = new TestClient();
     Assert.IsFalse(client.LoggedOut);
     client.Login(new { });
     client.Dispose();
     Assert.IsTrue(client.LoggedOut);
 }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:8,代码来源:CruiseServerClientBaseTests.cs


示例14: T01_Successful2

        public void T01_Successful2()
        {
            TestConnector c = new TestConnector();
            TestClient t= new TestClient();
            c.AsyncConnect(t, new TelnetParameter(GetConnectableIP(), GetConnectablePort()));
            t.WaitAndClose();

            Assert.IsTrue(c.Succeeded);
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:9,代码来源:InterruptableConnectorT.cs


示例15: T05_NotConnectable3

        public void T05_NotConnectable3()
        {
            TestConnector c = new TestConnector();
            TestClient t= new TestClient();
            c.AsyncConnect(t, new TelnetParameter(GetConnectableDNSName(), GetClosedPort())); //ホストはあるがポートが開いてない
            t.WaitAndClose();

            Assert.IsFalse(c.Succeeded);
            Debug.WriteLine(String.Format("NotConnectable3 [{0}]", c.ErrorMessage));
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:10,代码来源:InterruptableConnectorT.cs


示例16: T04_NotConnectable2

        public void T04_NotConnectable2()
        {
            TestConnector c = new TestConnector();
            TestClient t= new TestClient();
            c.AsyncConnect(t, new TelnetParameter(GetUnknownDNSName(), GetConnectablePort())); //DNSエラー
            t.WaitAndClose();

            Assert.IsFalse(c.Succeeded);
            Debug.WriteLine(String.Format("NotConnectable2 [{0}]", c.ErrorMessage));
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:10,代码来源:InterruptableConnectorT.cs


示例17: T03_NotConnectable1

        public void T03_NotConnectable1()
        {
            TestConnector c = new TestConnector();
            TestClient t= new TestClient();
            c.AsyncConnect(t, new TelnetParameter(GetUnreachableIP(), GetConnectablePort())); //存在しないホスト
            t.WaitAndClose();

            Assert.IsFalse(c.Succeeded);
            Debug.WriteLine(String.Format("NotConnectable1 [{0}]", c.ErrorMessage));
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:10,代码来源:InterruptableConnectorT.cs


示例18: SetUp

        public void SetUp()
        {
            UUID userId = TestHelpers.ParseTail(0x3);

            J2KDecoderModule j2kdm = new J2KDecoderModule();

            SceneHelpers sceneHelpers = new SceneHelpers();
            scene = sceneHelpers.SetupScene();
            SceneHelpers.SetupSceneModules(scene, j2kdm);

            tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene);
            llim = new LLImageManager(tc, scene.AssetService, j2kdm);
        }
开发者ID:justasabc,项目名称:opensim75,代码行数:13,代码来源:LLImageManagerTests.cs


示例19: LoginConvertsObjectToCredentials

 public void LoginConvertsObjectToCredentials()
 {
     var client = new TestClient();
     var credentials = new
     {
         UserName = "JohnDoe",
         Password = (string)null
     };
     client.Login(credentials);
     Assert.AreEqual(2, client.Credentials.Count);
     Assert.AreEqual("UserName", client.Credentials[0].Name);
     Assert.AreEqual(credentials.UserName, client.Credentials[0].Value);
     Assert.AreEqual("Password", client.Credentials[1].Name);
     Assert.AreEqual(credentials.Password, client.Credentials[1].Value);
 }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:15,代码来源:CruiseServerClientBaseTests.cs


示例20: SetUp

        public void SetUp()
        {
            m_iam = new BasicInventoryAccessModule();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
            
            m_scene = SceneHelpers.SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, config, m_iam);
            
            // Create user
            string userFirstName = "Jock";
            string userLastName = "Stirrup";
            string userPassword = "troll";
            UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);                        
            
            AgentCircuitData acd = new AgentCircuitData();
            acd.AgentID = m_userId;
            m_tc = new TestClient(acd, m_scene);            
        }
开发者ID:NovaGrid,项目名称:opensim,代码行数:21,代码来源:InventoryAccessModuleTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TestContext类代码示例发布时间:2022-05-24
下一篇:
C# TestClassGenerationContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap