コード例 #1
0
        public async Task Should_Get_Products_Of_User()
        {
            IdentityUser user = await _userManager.FindByNameAsync("admin");

            user.ShouldNotBeNull();

            using (var uow = _unitOfWorkManager.Begin(requiresNew: true))
            {
                var ou112 = (await _organizationUnitRepository.GetListAsync()).FirstOrDefault(ou =>
                                                                                              ou.DisplayName.Equals(DataConstants.Ou112Name));

                await _userManager.AddToOrganizationUnitAsync(user.Id, ou112.Id);

                await uow.CompleteAsync();
            }

            var productList = await _productManager.GetProductForUserAsync(user.Id);

            productList.ShouldContain(t => t.Name.Contains("Nvidia"));
            productList.Count.ShouldBe(4);
        }