public void ShouldThrowArgumentExceptionWithCorrectMessage_WhenMaxPricePropertyIsNotPositive(int testMaxPrice) { int vehicleId = 3; int cityId = 3; int minPrice = 3; int maxPrice = testMaxPrice; int yearFrom = 3; int yearTo = 3; 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 searchEventArgs = new SearchEventArgs(cityId, minPrice, maxPrice, yearFrom, yearTo, vehicleId); Assert.That( () => searcherPresenter.View_OnSearchAdverts(null, searchEventArgs), Throws.InstanceOf <ArgumentException>()); }
public void InvokeAdvertService_GetAdvertsByMultipleParametersMethodOnce() { int vehicleId = 3; int cityId = 3; int minPrice = 3; int maxPrice = 3; int yearFrom = 3; int yearTo = 3; 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 searchEventArgs = new SearchEventArgs(cityId, minPrice, maxPrice, yearFrom, yearTo, vehicleId); searcherPresenter.View_OnSearchAdverts(null, searchEventArgs); advertServiceMock.Verify(service => service.GetAdvertsByMultipleParameters(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>()), Times.Once); }