public void ctorParameter_Id1073741823_ReturnsInstance()
        {
            var id = 1073741823u;
            var packetSequence = new DicePacketSequence(id, PacketType.Request, PacketOrigin.Client);

            Assert.Equal(id, packetSequence.Id);
        }
Esempio n. 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();
        }
        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);
        }
        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);
        }
Esempio n. 5
0
        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());
        }
        public void ToBytes_NewSequence_BytesLength4()
        {
            var sequence = new DicePacketSequence(1u, PacketType.Request, PacketOrigin.Client);

            var bytes = sequence.ToBytes();

            Assert.Equal(4, bytes.Count());
        }
 public void GetHashCode_WithSameInstance_IsEqual()
 {
     var instance = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.Equal(instance.GetHashCode(), instance.GetHashCode());
 }
 public void Equals_StringTest_NotEqual()
 {
     var sequence = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.False(Equals(sequence, "Test"));
 }
 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);
 }
Esempio n. 10
0
 public void Equals_OneSequenceNull_False()
 {
     var sequence = new DicePacketSequence(123, PacketType.Request, PacketOrigin.Client);
     Assert.False(Equals(sequence, null));
 }
Esempio n. 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));
 }
Esempio n. 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);
        }