public void BrowseMessageSerializationTest()
        {
            var sm = new BrowseMessage(Servicetype, Domain, InterfaceIndex);

            var bm = ServiceMessageTestHelper.SerializeDeserializeTest(sm);

            bm.Payload.ServiceType.Should().Be(Servicetype);
            bm.Payload.Domain.Should().Be(Domain);
            bm.Payload.InterfaceIndex.Should().Be(InterfaceIndex);
        }
Beispiel #2
0
        public void ResolveMessageSerializationTest()
        {
            var om = new ResolveMessage(InstanceName, ServiceType, Domain, InterfaceIndex);

            var dm = ServiceMessageTestHelper.SerializeDeserializeTest(om);

            dm.Payload.InstanceName.Should().Be(InstanceName);
            dm.Payload.ServiceType.Should().Be(ServiceType);
            dm.Payload.Domain.Should().Be(Domain);
            dm.Payload.InterfaceIndex.Should().Be(InterfaceIndex);
        }
Beispiel #3
0
        public void LookupMessageSerializationTest()
        {
            var om = new LookupMessage(HostName, ProtoFlags, true, InterfaceIndex);

            var message = ServiceMessageTestHelper.SerializeDeserializeTest(om);

            message.Payload.HostName.Should().Be(HostName);
            message.Payload.ProtocolFlags.Should().Be(ProtoFlags);
            message.Payload.Flags.Should().Be(Flags);
            message.Payload.InterfaceIndex.Should().Be(InterfaceIndex);
        }
        public void RegisterMessageSerializationTest()
        {
            var om = new RegisterMessage(InstanceName, Servicetype, Domain, HostName, ushort.MaxValue, _txtRecordBytes, ServiceFlags.Bogus, InterfaceIndex);

            var message = ServiceMessageTestHelper.SerializeDeserializeTest(om);

            message.Payload.InstanceName.Should().Be(InstanceName);
            message.Payload.HostName.Should().Be(HostName);
            message.Payload.ServiceType.Should().Be(Servicetype);
            message.Payload.Domain.Should().Be(Domain);
            message.Payload.TxtRecord.Should().BeEquivalentTo(_txtRecordBytes);
            message.Payload.Flags.Should().Be(ServiceFlags.Bogus);
            message.Payload.InterfaceIndex.Should().Be(InterfaceIndex);
        }
        public void RequestMessageWithErrorReturnPortSerializationTest()
        {
            var sm = new BrowseMessage(Servicetype, Domain, InterfaceIndex);

            sm.SetSubordinateID(1); // Marks message as subordinate

            // Subordinate message with no ErrorReturnPort value set should throw on serialization
            Action act = () => sm.GetBytes();

            act.Should().Throw <InvalidOperationException>();

            sm.Payload.ErrorReturnPort = Port;

            var bm = ServiceMessageTestHelper.SerializeDeserializeTest(sm);

            bm.Payload.ErrorReturnPort.Should().Be(Port);
        }