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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public ToppingController(ToppingService toppingService, IMapper mapper)
 {
     this.toppingService = toppingService;
     this.mapper         = mapper;
 }