예제 #1
0
        public void PerformCommand_ShouldFail_WhenAccessorFindsNoImages()
        {
            Arrange.Call(() => _imageAccessor.Get(default(ImageSource?), ImageGenre.Hardcore))
            .Returns(new List <ImageMetaData>());

            var actual = _service.PerformCommand(_session, Keyword.ShowHardcoreImage);

            Assert.AreEqual(ErrorMessage.NoImagesFound, actual.Error.Message);
        }
예제 #2
0
        public void PerformCommand_ShouldPassSameSession_WhenSucceeds()
        {
            var eventSession = default(Session);

            _service.CommandProcessed += (s, e) => eventSession = e.Session;

            Arrange.Call(() => _imageAccessor.Get(default(ImageSource?), ImageGenre.Hardcore))
            .Returns(new List <ImageMetaData>()
            {
                new ImageMetaData()
            });

            var actual = _service.PerformCommand(_session, Keyword.ShowHardcoreImage);

            Assert.AreEqual(actual.Value, eventSession);
        }
예제 #3
0
        public void PerformCommand_ShouldPassImageMetaData_WhenSucceeds()
        {
            var imageData = default(ImageMetaData);

            _service.CommandProcessed += (s, e) => imageData = e.Parameter as ImageMetaData;

            var foundImage = new ImageMetaData();

            Arrange.Call(() => _imageAccessor.Get(default(ImageSource?), ImageGenre.Hardcore))
            .Returns(new List <ImageMetaData>()
            {
                foundImage
            });

            var actual = _service.PerformCommand(_session, Keyword.ShowHardcoreImage);

            Assert.AreEqual(foundImage, imageData);
        }