Exemple #1
0
        public async Task CreateCustomerTest()
        {
            var groceryService = new Mock <IDataService>();
            var controller     = new ValuesController(groceryService.Object);

            groceryService
            .Setup(x => x.GetCustomerData())
            .ReturnsAsync(DefaultCustomerListJSON());

            var cust = new Customer {
                Id = 3, Name = "Bryan"
            };
            var result = await controller.CreateCustomer(cust);

            Assert.IsType <CreatedAtRouteResult>(result.Result);
        }