コード例 #1
0
        public async void TestCreateManager()
        {
            var dbContext          = DbContextMocker.GetContext(nameof(this.TestCreateManager));
            var managersRepository = new ManagersRepository(dbContext, AutoMapperConfiguration.ConfigureForWeb().CreateMapper());
            var managersService    = new ManagersService(managersRepository, null);
            var controller         = new ManagersController(managersService, AutoMapperConfiguration.ConfigureForWeb().CreateMapper());

            var parameters = new ManagersViewModel()
            {
                FirstName = "john",
                LastName  = "Shon",
            };
            var response = await controller.CreateNewManager(parameters);

            Assert.Equal(1, dbContext.Managers.Where(c => c.LastName == "Shon").Count());

            dbContext.Dispose();
        }