public void WhenDeserializingEmptyByteArray_ThenReturnsDefaultOfT()
        {
            var serializer = new FakeSerializer();
            var result     = serializer.Deserialize <Data>(new byte[0]);

            Assert.Null(result);
        }
        public void WhenDeserializing_ThenInvokesSerializer()
        {
            var data       = new Data();
            var serializer = new FakeSerializer(data);
            var result     = serializer.Deserialize <Data>(new byte[] { 25, 20 });

            Assert.Same(data, result);
        }
        public void WhenDeserializingNullByteArray_ThenThrowsArgumentNullException()
        {
            var serializer = new FakeSerializer();

            Assert.Throws <ArgumentNullException>(() => serializer.Deserialize <Data>((byte[])null));
        }
Beispiel #4
0
            public Task OnNext(byte[] itemData, StreamSequenceToken token = null)
            {
                var item = (T)_serializer.Deserialize(itemData);

                return(_observer.OnNextAsync(item, token));
            }