Пример #1
0
        //
        // GET: /Manage/Index
        public async Task <ActionResult> Index(ManageMessageId?message)
        {
            var userId = User.Identity.GetUserId();

            model.Orders = OrderDataService.UserOrders(userId);
            model.CustomerAccountInfo = CustomerDataService.GetCustomer(userId);
            //ViewBag.StatusMessage =
            //    message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
            //    : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
            //    : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
            //    : message == ManageMessageId.Error ? "An error has occurred."
            //    : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
            //    : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
            //    : "";

            //var userId = User.Identity.GetUserId();
            //var model = new IndexViewModel
            //{
            //    HasPassword = HasPassword(),
            //    PhoneNumber = await UserManager.GetPhoneNumberAsync(userId),
            //    TwoFactor = await UserManager.GetTwoFactorEnabledAsync(userId),
            //    Logins = await UserManager.GetLoginsAsync(userId),
            //    BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(userId)
            //};
            return(View(model));
        }
Пример #2
0
        public async Task GetCustomerKeyNotFound()
        {
            var databaseRepoMock = new Mock <IDatabaseRepository>();

            databaseRepoMock.Setup(repo => repo.ReadDatabase().Result).Returns(TestDatabaseFilled);
            var customerDataService = new CustomerDataService(databaseRepoMock.Object, _mockLogger.Object);

            await Assert.ThrowsAnyAsync <KeyNotFoundException>(async() => await customerDataService.GetCustomer(-999));
        }
Пример #3
0
        public async Task GetCustomerSuccess()
        {
            var databaseRepoMock = new Mock <IDatabaseRepository>();

            databaseRepoMock.Setup(repo => repo.ReadDatabase().Result).Returns(TestDatabaseFilled);
            var customerDataService = new CustomerDataService(databaseRepoMock.Object, _mockLogger.Object);

            var customer = await customerDataService.GetCustomer(1);

            Assert.NotNull(customer);
        }