예제 #1
0
        public async Task When_SetSourceAsync_Stream_Then_StreamClonedSynchronously()
        {
            var sut    = new BitmapImage();
            var stream = new Given_BitmapSource_Stream();

            var success = false;

            try
            {
                sut.SetSourceAsync(stream);                 // Note: We do not await the task here. It has to fail within the method itself!
            }
            catch (Given_BitmapSource_Exception ex) when(ex.Caller is nameof(Given_BitmapSource_Stream.Read))
            {
                success = true;
            }

            Assert.IsTrue(success);
        }
예제 #2
0
        public async Task When_SetSource_Stream_Then_StreamClonedSynchronously()
        {
            var sut    = new BitmapImage();
            var stream = new Given_BitmapSource_Stream();

            var success = false;

            try
            {
                sut.SetSource(stream);
            }
            catch (Given_BitmapSource_Exception ex) when(ex.Caller is nameof(Given_BitmapSource_Stream.Read))
            {
                success = true;
            }

            Assert.IsTrue(success);
        }