Пример #1
0
        public void TestCharacterListOld()
        {
            var firstMobile = new Mobile(0x1);

            firstMobile.DefaultMobileInit();
            firstMobile.Name = "Test Mobile";

            var acct = new MockAccount(new[] { null, firstMobile, null, null, null });
            var info = new[]
            {
                new CityInfo("Test City", "Test Building", 50, 100, 10, -10)
            };

            var expected = new CharacterListOld(acct, info).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.CityInfo  = info;
            ns.Account   = acct;

            ns.SendCharacterList();

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Пример #2
0
        public void TestCharacterListUpdate()
        {
            var firstMobile = new Mobile(0x1);

            firstMobile.DefaultMobileInit();
            firstMobile.RawName = "Test Mobile";

            var acct = new MockAccount(new[] { null, firstMobile, null, null, null });

            var expected = new CharacterListUpdate(acct).Compile();

            using var ns = PacketTestUtilities.CreateTestNetState();
            ns.SendCharacterListUpdate(acct);

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }
Пример #3
0
        public void TestSupportedFeatures(ProtocolChanges protocolChanges)
        {
            var firstMobile = new Mobile(0x1);

            firstMobile.DefaultMobileInit();
            firstMobile.Name = "Test Mobile";

            var account = new MockAccount(new[] { firstMobile, null, null, null, null });

            using var ns       = PacketTestUtilities.CreateTestNetState();
            ns.Account         = account;
            ns.ProtocolChanges = protocolChanges;

            var expected = new SupportedFeatures(ns).Compile();

            ns.SendSupportedFeature();

            var result = ns.SendPipe.Reader.TryRead();

            AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
        }