public void UnFavouriteFoodItem(string personReference, int sku) { var person = personRepository.FindPersonWithReference(PersonReference.FromExisting(personReference)); var foodItem = foodItemRepository.FindFoodItemWithSku(sku); person.UnFavorite(foodItem); personRepository.Save(person); }
public void FavoritingAnItemShouldRaiseAnEvent() { var person = new Person(PersonReference.FromExisting("ref-001"), "Homer"); var foodItem = new FoodItem(7463928, "Extra Strong Concentrated Squishee Syrup"); PersonFavoritedFoodItemEvent raisedEvent = null; DomainEvents.Register <PersonFavoritedFoodItemEvent>((obj) => raisedEvent = (obj)); person.Favorite(foodItem); Assert.IsInstanceOf(typeof(PersonFavoritedFoodItemEvent), raisedEvent); Assert.AreEqual(person, raisedEvent.Person); Assert.AreEqual(foodItem, raisedEvent.FoodItem); }
public void GivenIHaveAPersonWithTheReferenceNamed(string reference, string name) { this.people.Add(reference, new Person(PersonReference.FromExisting(reference), name)); }
public InMemoryPersonRepository() { people.Add(new Person(PersonReference.FromExisting("ref-001"), "James")); }