public void SetUp() { var getPizzaPriceRepository = new Mock <IPizzaSizeRepository>(); getPizzaPriceRepository.Setup(x => x.GetAll()).Returns(new GetPizzaSizesResponse { PizzaSizes = new List <PizzaSizeRecord> { new PizzaSizeRecord { Pizza = new PizzaRecord { Id = 1, Name = "Original" }, Size = new SizeRecord { Id = 1, Name = "Small" }, Price = 800 }, new PizzaSizeRecord { Pizza = new PizzaRecord { Id = 2, Name = "Veggie Delight" }, Size = new SizeRecord { Id = 1, Name = "Medium" }, Price = 1100 } } }); var pizzaToppingRepository = new Mock <IPizzaToppingRepository>(); pizzaToppingRepository.Setup(x => x.GetAll()).Returns(new GetPizzaToppingResponse { HasError = true, Error = new Error { Code = ErrorCodes.DatabaseError, UserMessage = "Something went wrong" } }); var subject = new PizzaSizeService(getPizzaPriceRepository.Object, pizzaToppingRepository.Object); _result = subject.GetAll(); }
public void SetUp() { var getPizzaPriceRepository = new Mock <IPizzaSizeRepository>(); getPizzaPriceRepository.Setup(x => x.GetAll()).Returns(new GetPizzaSizesResponse { HasError = true, Error = new Error { UserMessage = "Something went wrong when retrieving PizzaRecords." } }); var subject = new PizzaSizeService(getPizzaPriceRepository.Object, null); _result = subject.GetAll(); }
public void SetUp() { var getPizzaPriceRepository = new Mock <IPizzaSizeRepository>(); getPizzaPriceRepository.Setup(x => x.GetAll()).Returns(new GetPizzaSizesResponse { PizzaSizes = new List <PizzaSizeRecord> { new PizzaSizeRecord { Pizza = new PizzaRecord { Id = 1, Name = "Original" }, Size = new SizeRecord { Id = 1, Name = "Small" }, Price = 800 }, new PizzaSizeRecord { Pizza = new PizzaRecord { Id = 2, Name = "Veggie Delight" }, Size = new SizeRecord { Id = 1, Name = "Medium" }, Price = 1100 } } }); var pizzaToppingRepository = new Mock <IPizzaToppingRepository>(); pizzaToppingRepository.Setup(x => x.GetAll()).Returns(new GetPizzaToppingResponse { PizzaToppings = new List <PizzaToppingRecord> { new PizzaToppingRecord { Pizza = new PizzaRecord { Id = 1, Name = "Original" }, Topping = new ToppingRecord { Id = 1, Name = "Cheese" } }, new PizzaToppingRecord { Pizza = new PizzaRecord { Id = 1, Name = "Original" }, Topping = new ToppingRecord { Id = 2, Name = "Bacon" } } } }); var subject = new PizzaSizeService(getPizzaPriceRepository.Object, pizzaToppingRepository.Object); _result = subject.GetAll(); }