public void SetModel_ServiceResultHasConsumedBeers_RemovesConsumedBeers() { //Arrange view.Setup(v => v.Model).Returns(new BeerCollectionModel()); var beer1 = new Beer { BeerId = 1, Name = "Bigfoot", IsConsumed = true }; var beer2 = new Beer { BeerId = 2, Name = "Yeti", IsConsumed = false }; var beerList = new List<Beer> { beer1, beer2 }; service.Setup(s => s.GetBeers()).Returns(beerList.AsQueryable()); presenter = new BeersToDrinkSoonPresenter(view.Object, service.Object) {Messages = messageCoordinator}; //Act view.Raise(x => x.Load += null, null, null); presenter.ReleaseView(); messageCoordinator.Close(); //Assert Assert.DoesNotContain(view.Object.Model.BeerCollection, beer1); }
public void SetModel_HasValidListOfBeers_SetsHasBeersProperty() { //Arrange view.Setup(v => v.Model).Returns(new BeerCollectionModel()); var beer1 = new Beer { BeerId = 1, Name = "Bigfoot", DrinkBy = new System.DateTime(2011, 10, 02) }; var beer2 = new Beer { BeerId = 2, Name = "Yeti", DrinkBy = new System.DateTime(2010, 4, 1) }; var beer3 = new Beer { BeerId = 3, Name = "Darkness", DrinkBy = new System.DateTime(2015, 10, 25) }; var beerList = new List<Beer> { beer1, beer2, beer3 }; service.Setup(s => s.GetBeers()).Returns(beerList.AsQueryable()); presenter = new BeersToDrinkSoonPresenter(view.Object, service.Object) { Messages = messageCoordinator }; //Act view.Raise(x => x.Load += null, null, null); presenter.ReleaseView(); messageCoordinator.Close(); //Assert Assert.AreEqual(view.Object.Model.HasBeers, true); }
public void AddBeer(Beer beer) { this.Context.Beers.InsertOnSubmit(beer); }
public void SetModel_ServiceResultIsGreaterThanThree_ReturnsThreeBeers() { //Arrange view.Setup(v => v.Model).Returns(new BeerCollectionModel()); var beer1 = new Beer { BeerId = 1, Name = "Bigfoot", IsConsumed = false }; var beer2 = new Beer { BeerId = 2, Name = "Yeti", IsConsumed = false }; var beer3 = new Beer { BeerId = 3, Name = "Darkness", IsConsumed = false }; var beer4 = new Beer { BeerId = 4, Name = "Furious", IsConsumed = false }; var beerList = new List<Beer> { beer1, beer2, beer3, beer4 }; service.Setup(s => s.GetBeers()).Returns(beerList.AsQueryable()); presenter = new BeersToDrinkSoonPresenter(view.Object, service.Object) { Messages = messageCoordinator }; //Act view.Raise(x => x.Load += null, null, null); presenter.ReleaseView(); messageCoordinator.Close(); //Assert Assert.AreEqual(view.Object.Model.BeerCollection.Count, 3); }
partial void DeleteBeer(Beer instance);
partial void UpdateBeer(Beer instance);
partial void InsertBeer(Beer instance);