Exemplo n.º 1
0
        public void ShouldThrowArgumentExceptionWithCorrectMessage_WhenGetPicturePathEventArgsAdvertIdPropertyIsNotPositive(int invalidADvertId)
        {
            var searchViewMock     = new Mock <ISearchView>();
            var advertServiceMock  = new Mock <IAdvertServices>();
            var pictureServiceMock = new Mock <IPictureServices>();

            var searcherPresenter = new SearcherPresenter(searchViewMock.Object, advertServiceMock.Object, pictureServiceMock.Object);

            var getPicturePathEvetnArgs = new GetPicturePathEventArgs(invalidADvertId);

            Assert.That(
                () => searcherPresenter.View_OnGetPicturePath(null, getPicturePathEvetnArgs),
                Throws.InstanceOf <ArgumentException>());
        }
Exemplo n.º 2
0
        public void InvokeIPictureService_GetFirstPicturesNameByAdvertIdMethodOnce()
        {
            var searchViewMock = new Mock <ISearchView>();

            searchViewMock.SetupGet(view => view.Model).Returns(new SearchViewModel());

            var advertServiceMock  = new Mock <IAdvertServices>();
            var pictureServiceMock = new Mock <IPictureServices>();

            var searcherPresenter = new SearcherPresenter(searchViewMock.Object, advertServiceMock.Object, pictureServiceMock.Object);

            var getPicturePathEvetnArgs = new GetPicturePathEventArgs(3);

            searcherPresenter.View_OnGetPicturePath(null, getPicturePathEvetnArgs);

            pictureServiceMock.Verify(service => service.GetFirstPicturesNameByAdvertId(It.IsAny <int>()), Times.Once);
        }