public void should() { string letter = "A"; var eventArg = new BandListEventArgs() { Letter = letter }; var viewMock = new Mock <IBandListView>(); viewMock.Setup(x => x.Model).Returns(new BandListModel()); var bands = this.GetBands(); var expectedResult = bands.Where(x => x.BandName.Substring(0, 1) == letter).ToList(); var bandServiceMock = new Mock <IBandService>(); bandServiceMock.Setup(x => x.GetBands(letter)).Returns(expectedResult); BandListPresenter bandListPresenter = new BandListPresenter(viewMock.Object, bandServiceMock.Object); viewMock.Raise(x => x.LoadBands += null, eventArg); CollectionAssert.AreEquivalent(expectedResult, viewMock.Object.Model.Bands); bandServiceMock.Verify(x => x.GetBands(letter), Times.Once); }
private void View_LoadBands(object sender, BandListEventArgs e) { this.View.Model.Bands = this.bandService.GetBands(e.Letter); }