public void SetUp() { var getToppingRepository = new Mock <IToppingRepository>(); getToppingRepository.Setup(x => x.GetAll()).Returns(new GetToppingsResponse { Toppings = new List <ToppingRecord> { new ToppingRecord { Id = 1, Name = "Onion" }, new ToppingRecord { Id = 2, Name = "Ham" } } }); var subject = new ToppingService(getToppingRepository.Object); _result = subject.GetAll(); }
public void SetUp() { var getToppingRepository = new Mock <IToppingRepository>(); getToppingRepository.Setup(x => x.GetAll()).Returns(new GetToppingsResponse { HasError = true, Error = new Error { UserMessage = "Something went wrong when retrieving ToppingRecords." } }); var subject = new ToppingService(getToppingRepository.Object); _result = subject.GetAll(); }