Example #1
0
        public override void Execute()
        {
            base.Execute();
            Source.RemoveAllPendingInvites();
            Destination.RemoveAllPendingInvites();

            var sourceNewSessionId = SessionsRepository.GetSessionId(Source);
            var initialPacket      = new Packet(Operation.GetId, Status.Initial, sourceNewSessionId, Source.Id);

            Source.SendTo(PacketFormatter.Serialize(initialPacket));
        }
Example #2
0
        public void Packet_Should_Serialize_Correctly()
        {
            var packet = new Packet(Operation.Invite, Status.Ok, Guid.Empty, 12345, new Timestamp(new DateTime(2018, 1, 1)));

            packet.SetMessage("Accepted");
            packet.SetDestinationId(12);
            var formatter = new PacketFormatter();
            var array     = formatter.Serialize(packet);
            var result    = Encoding.UTF8.GetString(array);

            const string expected =
                "Identyfikator-)12345(|Operacja-)Invite(|Status-)Ok(|timestamp-)1514764800(|sid-)00000000-0000-0000-0000-000000000000(|destination-)12(|message-)Accepted(|";

            Assert.Equal(expected, result);
        }