コード例 #1
0
        public void ctorParameter_Id1073741823_ReturnsInstance()
        {
            var id = 1073741823u;
            var packetSequence = new DicePacketSequence(id, PacketType.Request, PacketOrigin.Client);

            Assert.Equal(id, packetSequence.Id);
        }
コード例 #2
0
        public DicePacketFactoryTest()
        {
            var sequence = new DicePacketSequence(458u, PacketType.Request, PacketOrigin.Client);
            var words = new List<IDiceWord> { new DiceWord("listPlayers"), new DiceWord("all") };
            this.expectedPacket = new DicePacket(sequence, words);

            dicePacketFactory = new DicePacketFactory();
        }
コード例 #3
0
        public void ctorValues_WithDefaultParameters_IsImplementationOfIPacketSequence()
        {
            var id = (uint)123;
            var origin = PacketOrigin.Client;
            var type = PacketType.Request;

            var packetSequence = new DicePacketSequence(id, type, origin);

            Assert.IsAssignableFrom<IDicePacketSequence>(packetSequence);
        }
コード例 #4
0
        public void ctorValues_WithDefaultParameters_ReturnsInstance()
        {
            var id = (uint) 123;
            var origin = PacketOrigin.Client;
            var type = PacketType.Request;

            var packetSequence = new DicePacketSequence(id, type, origin);

            Assert.NotNull(packetSequence);
            Assert.Equal(id, packetSequence.Id);
            Assert.Equal(origin, packetSequence.Origin);
        }
コード例 #5
0
ファイル: DicePacketTest.cs プロジェクト: RConDev/RaptoRCon
        public void ToBytes_Packet458RequestServerListPlayersAll_BytesEqual()
        {
            var packetSequence = new DicePacketSequence((uint)458, PacketType.Request, PacketOrigin.Client);
            var words = new List<IDiceWord>() {new DiceWord("listPlayers"), new DiceWord("all")};
            var packet = new DicePacket(packetSequence, words);

            var expectedBytes = Convert.FromBase64String("ygEAgCQAAAACAAAACwAAAGxpc3RQbGF5ZXJzAAMAAABhbGwA");
            Assert.Equal(expectedBytes, packet.ToBytes());
        }
コード例 #6
0
        public void ToBytes_NewSequence_BytesLength4()
        {
            var sequence = new DicePacketSequence(1u, PacketType.Request, PacketOrigin.Client);

            var bytes = sequence.ToBytes();

            Assert.Equal(4, bytes.Count());
        }
コード例 #7
0
 public void GetHashCode_WithSameInstance_IsEqual()
 {
     var instance = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.Equal(instance.GetHashCode(), instance.GetHashCode());
 }
コード例 #8
0
 public void Equals_StringTest_NotEqual()
 {
     var sequence = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.False(Equals(sequence, "Test"));
 }
コード例 #9
0
 public void Equals_Sequence123ClientRequest_True()
 {
     var sequence = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     var sequence2 = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.Equal(sequence, sequence2);
 }
コード例 #10
0
 public void Equals_OneSequenceNull_False()
 {
     var sequence = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.False(Equals(sequence, null));
 }
コード例 #11
0
 public void Equals_DifferentPackets_False()
 {
     var sequence = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     var sequence2 = new DicePacketSequence(124, PacketType.Request, PacketOrigin.Client);
     Assert.False(Equals(sequence, sequence2));
 }
コード例 #12
0
        public void ToBytes_PacketRequestClient1_Equals()
        {
            var expectedBytes = Convert.FromBase64String("AQAAgA==");
            var sequence = new DicePacketSequence(1u, PacketType.Request, PacketOrigin.Client);

            var bytes = sequence.ToBytes();
            Assert.Equal(expectedBytes, bytes);
        }