示例#1
0
        public void ProxyConnection_InstructionObjectPlayerIs(string testc, string ExpectedValue)
        {
            lock (parseLock)
            {
                bool isTested = false;
                Proxy.SendFormattedTextToServer("- Shout");
                Proxy.ProcessServerChannelData += (sender, Args) =>
                {
                    if (!isTested && sender is ChannelObject ServeObject)
                    {
                        isTested = true;
                        Assert.That(ServeObject.Player.Message.Trim(),
                                    Is.EqualTo(ExpectedValue.Trim()),
                                    $"Player.Message '{ServeObject.Player.Message}' ExpectedValue: {ExpectedValue}"
                                    );
                    }
                };

                Proxy.ParseServerChannel(testc, false);
                Proxy.ProcessServerChannelData -= (sender, Args) =>
                {
                    if (!isTested && sender is ChannelObject ServeObject)
                    {
                        isTested = true;
                        Assert.That(ServeObject.Player.Message.Trim(),
                                    Is.EqualTo(ExpectedValue.Trim()),
                                    $"Player.Message '{ServeObject.Player.Message}' ExpectedValue: {ExpectedValue}"
                                    );
                    }
                };
            }
        }
示例#2
0
        public void ChannelParserNoConnectionInstructionObjectPlayerIs(string testc, string ExpectedValue)
        {
            //Turn the channel on
            Proxy.SendFormattedTextToServer("- Shout");

            Proxy.ProcessServerChannelData += (sender, Args) =>
            {
                if (sender is ChannelObject InstructionObject)
                {
                    Assert.That(InstructionObject.Player.Message,
                                Is.EqualTo(ExpectedValue));
                }
            };

            Proxy.ParseServerChannel(testc, false);

            Proxy.ProcessServerChannelData -= (sender, Args) =>
            {
                if (sender is ChannelObject InstructionObject)
                {
                    Assert.That(InstructionObject.Player.Message,
                                Is.EqualTo(ExpectedValue));
                }
            };
        }
示例#3
0
        public void DreamBookmarkSettingsTest(string DreamUrl, string DreamOwner, string DreamTitle = null)
        {
            Proxy.ProcessServerInstruction += (data, handled) =>
            {
                if (data is DreamBookmark)
                {
                    Assert.Multiple(() =>
                    {
                        Assert.That(Proxy.Dream.DreamOwner, Is.EqualTo(DreamOwner.ToFurcadiaShortName()), $"Dream Owner: {Proxy.Dream.DreamOwner}");
                        if (string.IsNullOrWhiteSpace(Proxy.Dream.Title))
                        {
                            Assert.That(Proxy.Dream.DreamUrl, Is.EqualTo($"furc://{DreamOwner.ToFurcadiaShortName()}/"), $"Dream URL {Proxy.Dream.DreamUrl}");
                        }
                        else
                        {
                            Assert.That(Proxy.Dream.DreamUrl, Is.EqualTo($"furc://{DreamOwner.ToFurcadiaShortName()}:{DreamTitle.ToFurcadiaShortName()}/"), $"Dream URL {Proxy.Dream.DreamUrl}");
                        }
                    });
                }
            };

            Proxy.SendFormattedTextToServer($"`fdl {DreamUrl}");

            Proxy.ProcessServerInstruction -= (data, handled) =>
            {
                if (data is DreamBookmark)
                {
                    Assert.Multiple(() =>
                    {
                        Assert.That(Proxy.Dream.DreamOwner, Is.EqualTo(DreamOwner.ToFurcadiaShortName()), $"Dream Owner: {Proxy.Dream.DreamOwner}");
                        if (string.IsNullOrWhiteSpace(Proxy.Dream.Title))
                        {
                            Assert.That(Proxy.Dream.DreamUrl, Is.EqualTo($"furc://{DreamOwner.ToFurcadiaShortName()}/"), $"Dream URL {Proxy.Dream.DreamUrl}");
                        }
                        else
                        {
                            Assert.That(Proxy.Dream.DreamUrl, Is.EqualTo($"furc://{DreamOwner.ToFurcadiaShortName()}:{DreamTitle.ToFurcadiaShortName()}/"), $"Dream URL {Proxy.Dream.DreamUrl}");
                        }
                    });
                }
            };
        }