Esempio n. 1
0
        public void AcceptStream()
        {
            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);
            var msg = new StreamData
            {
                Data = new MemoryStream(),
            };

            var endpoint = new DataReceivingEndpoint(systemDiagnostics);

            endpoint.OnNewData += (s, e) => Assert.AreSame(msg.Data, e.Data.Data);

            endpoint.AcceptStream(msg);
        }
Esempio n. 2
0
        public void AcceptStreamThrowingException()
        {
            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);
            var msg = new StreamData
            {
                Data = new MemoryStream(),
            };

            var endpoint = new DataReceivingEndpoint(systemDiagnostics);

            endpoint.OnNewData +=
                (s, e) =>
            {
                throw new Exception();
            };

            Assert.DoesNotThrow(() => endpoint.AcceptStream(msg));
        }