public void CheckForFavorite_BreweryNotSavedAsFavorite_ReturnsNull()
        {
            var brewery = new Brewery { Id = 42, Name = "Duff" };

            var fave = _favoriteBreweryRepository.CheckForFavorite(brewery.Id).Test();

            Assert.IsNull(fave);
        }
        public void CheckForFavorite_BrewerySavedAsFavorite_ReturnsFavorite()
        {
            var brewery = new Brewery { Id = 42, Name = "Duff" };

            var fave = _favoriteBreweryRepository.SaveFavorite(brewery.Id, brewery.Name).Test();

            Assert.AreNotEqual(0, fave.Id);
            Assert.AreEqual(brewery.Id, fave.BreweryId);
            Assert.AreEqual(brewery.Name, fave.Name);

            var checkedFavorite = _favoriteBreweryRepository.CheckForFavorite(brewery.Id).Test();

            Assert.AreEqual(fave.Id, checkedFavorite.Id);
            Assert.AreEqual(fave.BreweryId, checkedFavorite.BreweryId);
            Assert.AreEqual(fave.Name, checkedFavorite.Name);
        }
        public void RemoveFavorite_FavoriteAlreadyRemoved_DoesNothing()
        {
            var brewery = new Brewery { Id = 42, Name = "Duff" };

            var fave = _favoriteBreweryRepository.SaveFavorite(brewery.Id, brewery.Name).Test();

            var allFaves = _favoriteBreweryRepository.ListFavoriteBreweries().Test();

            Assert.AreEqual(1, allFaves.Count);

            _favoriteBreweryRepository.RemoveFavorite(fave).Wait();

            allFaves = _favoriteBreweryRepository.ListFavoriteBreweries().Test();

            Assert.AreEqual(0, allFaves.Count);

            _favoriteBreweryRepository.RemoveFavorite(fave).Wait();

            allFaves = _favoriteBreweryRepository.ListFavoriteBreweries().Test();

            Assert.AreEqual(0, allFaves.Count);
        }
        public void SaveFavorite_SavesToDatabase_ReturnsSavedFavorite()
        {
            var brewery = new Brewery { Id = 42, Name = "Duff" };

            var fave = _favoriteBreweryRepository.SaveFavorite(brewery.Id, brewery.Name).Test();

            Assert.AreNotEqual(0, fave.Id);
            Assert.AreEqual(brewery.Id, fave.BreweryId);
            Assert.AreEqual(brewery.Name, fave.Name);

            var allFaves = _favoriteBreweryRepository.ListFavoriteBreweries().Test();

            Assert.AreEqual(1, allFaves.Count());

            var savedFave = allFaves.First();

            Assert.AreEqual(fave.Id, savedFave.Id);
            Assert.AreEqual(fave.BreweryId, savedFave.BreweryId);
            Assert.AreEqual(fave.Name, savedFave.Name);
        }