• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Models.ApplicationUser类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AllReady.Models.ApplicationUser的典型用法代码示例。如果您正苦于以下问题:C# ApplicationUser类的具体用法?C# ApplicationUser怎么用?C# ApplicationUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ApplicationUser类属于AllReady.Models命名空间,在下文中一共展示了ApplicationUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LoadTestData

        protected override void LoadTestData()
        {
            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            _user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true, NormalizedUserName =  username1.ToUpperInvariant() };
            _user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true, NormalizedUserName = username2.ToUpperInvariant() };
            Context.Users.Add(_user1);
            Context.Users.Add(_user2);
            var claimForUser1 = new IdentityUserClaim<string>
            {
                UserId = _user1.Id,
                ClaimType = ClaimTypes.ProfileIncomplete,
                ClaimValue = "NewUser"
            };
            Context.UserClaims.Add(claimForUser1);

            var claimForUser2 = new IdentityUserClaim<string>
            {
                UserId = _user2.Id,
                ClaimType = "SomeOtherClaim",
                ClaimValue = "Blah"
            };
            Context.UserClaims.Add(claimForUser2);

            Context.SaveChanges();
        }
开发者ID:codethug,项目名称:allReady,代码行数:27,代码来源:RemoveUserProfileIncompleteClaimCommandHandlerTests.cs


示例2: InvokeUpdateTaskSignupAsyncWithTheCorrectParametersForEachTaskSignupViewModelOnCommand

        public async Task InvokeUpdateTaskSignupAsyncWithTheCorrectParametersForEachTaskSignupViewModelOnCommand()
        {
            var options = CreateNewContextOptions();

            const string userId = "1";
            const int taskSignupId = 1;
            var user = new ApplicationUser {Id = userId};
            var dateTimeUtcNow = DateTime.UtcNow;
            var taskSignupViewModels = new List<TaskSignupViewModel>
            {
                new TaskSignupViewModel { Id = taskSignupId, StatusDescription = "statusDescription1", Status = "Status1", TaskId = 1, }
            };

            var message = new UpdateMyTasksCommand { TaskSignups = taskSignupViewModels, UserId = userId};

            using (var context = new AllReadyContext(options))
            {
                context.Users.Add(user);
                context.TaskSignups.Add(new TaskSignup { Id = taskSignupId });
                context.Tasks.Add(new AllReadyTask { Id = 1 });
                await context.SaveChangesAsync();
            }

            using (var context = new AllReadyContext(options))
            {
                var sut = new UpdateMyTasksCommandHandler(context) { DateTimeUtcNow = () => dateTimeUtcNow };
                await sut.Handle(message);
            }

            using (var context = new AllReadyContext(options))
            {
                var signup = context.TaskSignups.FirstOrDefault(x => x.Id == taskSignupId);
                Assert.Equal(signup != null, true);
            }
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:35,代码来源:UpdateMyTasksHandlerShould.cs


示例3: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);            
            context.Organizations.Add(htb);
            
            var task = new AllReadyTask
            {
                Event = queenAnne,
                Description = "Description of a very important task",
                Name = "Task # ",
                EndDateTime = DateTime.Now.AddDays(1),
                StartDateTime = DateTime.Now.AddDays(-3)
            };
            queenAnne.Tasks.Add(task);
            context.Events.Add(queenAnne);

            var taskSignups = new List<TaskSignup>
            {
                new TaskSignup { Task = task, User = user1 },
                new TaskSignup { Task = task, User = user2 }
            };
            context.TaskSignups.AddRange(taskSignups);

            context.SaveChanges();
        }
开发者ID:codethug,项目名称:allReady,代码行数:60,代码来源:MessageTaskVolunteersCommandHandlerAsyncTests.cs


示例4: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Tenant htb = new Tenant()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingTenant = htb
            };
            Activity queenAnne = new Activity()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);

            htb.Campaigns.Add(firePrev);
            context.Tenants.Add(htb);
            context.Activities.Add(queenAnne);

            var activitySignups = new List<ActivitySignup>();
            activitySignups.Add(new ActivitySignup { Activity = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow });

            context.ActivitySignup.AddRange(activitySignups);

            var newTask = new AllReadyTask()
            {
                Activity = queenAnne,
                Description = "Description of a very important task",
                Name = "Task # 1",
                EndDateTimeUtc = DateTime.Now.AddDays(5),
                StartDateTimeUtc = DateTime.Now.AddDays(3),
                Tenant = htb
            };
            newTask.AssignedVolunteers.Add(new TaskSignup()
            {
                Task = newTask,
                User = user1
            });
            context.Tasks.Add(newTask);

            context.SaveChanges();
        }
开发者ID:fr33k3r,项目名称:allReady,代码行数:60,代码来源:SignupStatusChange.cs


示例5: CanSaveZeroTasks

        public async Task CanSaveZeroTasks()
        {
            var options = CreateNewContextOptions();

            const string userId = "1";
            var user = new ApplicationUser {Id = userId};

            using (var context = new AllReadyContext(options))
            {
                context.Users.Add(user);
                await context.SaveChangesAsync();
            }

            var message = new UpdateMyTasksCommand { UserId =userId, TaskSignups = new List<TaskSignupViewModel>() };

            using (var context = new AllReadyContext(options))
            {
                var sut = new UpdateMyTasksCommandHandler(context);
                await sut.Handle(message);
            }

            using (var context = new AllReadyContext(options))
            {
                var taskSignups = context.TaskSignups.Count();
                Assert.Equal(taskSignups, 0);
            }
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:27,代码来源:UpdateMyTasksHandlerShould.cs


示例6: InvokeUpdateTaskSignupAsyncWithTheCorrectParametersForEachTaskSignupViewModelOnCommand

        public async Task InvokeUpdateTaskSignupAsyncWithTheCorrectParametersForEachTaskSignupViewModelOnCommand()
        {
            var user = new ApplicationUser();
            var dateTimeUtcNow = DateTime.UtcNow;
            var taskSignupViewModels = new List<TaskSignupViewModel>
            {
                new TaskSignupViewModel { Id = 1, StatusDescription = "statusDescription1", Status = "Status1", TaskId = 1, }
            };

            var message = new UpdateMyTasksCommandAsync { TaskSignups = taskSignupViewModels };

            var dataAccess = new Mock<IAllReadyDataAccess>();
            dataAccess.Setup(x => x.GetUser(It.IsAny<string>())).Returns(user);

            var sut = new UpdateMyTasksHandlerAsync(dataAccess.Object) { DateTimeUtcNow = () => dateTimeUtcNow };
            await sut.Handle(message);

            dataAccess.Verify(x => x.UpdateTaskSignupAsync(It.Is<TaskSignup>(y =>
                y.Id == taskSignupViewModels[0].Id &&
                y.StatusDateTimeUtc == dateTimeUtcNow &&
                y.StatusDescription == taskSignupViewModels[0].StatusDescription &&
                y.Status == taskSignupViewModels[0].Status &&
                y.Task.Id == taskSignupViewModels[0].TaskId &&
                y.User == user)));
        }
开发者ID:codethug,项目名称:allReady,代码行数:25,代码来源:UpdateMyTasksHandlerAsyncShould.cs


示例7: Register

        public async Task<IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser
                {
                    UserName = model.Email,
                    Email = model.Email,
                    TimeZoneId = _generalSettings.Value.DefaultTimeZone
                };

                var result = await _userManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);
                    //note: had to change Url.Action to take a UrlActionContext b/c "Url.Action" is really an extension method that eventually uses UrlActionContext, and extension methods are not mockable
                    var callbackUrl = Url.Action(new UrlActionContext { Action = nameof(ConfirmEmail), Controller = "Admin", Values = new { userId = user.Id, token = token }, Protocol = Request.Scheme });
                    await _emailSender.SendEmailAsync(model.Email, "Confirm your account", $"Please confirm your account by clicking this <a href=\"{callbackUrl}\">link</a>");
                    return RedirectToAction(nameof(DisplayEmail), "Admin");
                }

                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
开发者ID:mmoore99,项目名称:allReady,代码行数:27,代码来源:AdminController.cs


示例8: SendNotificationToVolunteersWithCorrectMessage

        public async Task SendNotificationToVolunteersWithCorrectMessage()
        {
            const string expectedMessage = "You've been assigned a task from AllReady.";
            var @task = new AllReadyTask { Id = 1 };
            var volunteer = new ApplicationUser
            {
                Id = "user1",
                Email = "[email protected]",
                PhoneNumber = "1234",
                EmailConfirmed = true,
                PhoneNumberConfirmed = true
            };

            Context.Add(volunteer);
            Context.Add(@task);
            Context.SaveChanges();

            var message = new TaskAssignedToVolunteersNotification { TaskId = @task.Id, NewlyAssignedVolunteers = new List<string> { volunteer.Id } };
            await sut.Handle(message);

            mediator.Verify(b => b.SendAsync(It.Is<NotifyVolunteersCommand>(notifyCommand =>
                   notifyCommand.ViewModel.EmailMessage == expectedMessage &&
                   notifyCommand.ViewModel.Subject == expectedMessage &&
                   notifyCommand.ViewModel.EmailRecipients.Contains(volunteer.Email) &&
                   notifyCommand.ViewModel.SmsRecipients.Contains(volunteer.PhoneNumber) &&
                   notifyCommand.ViewModel.SmsMessage == expectedMessage
            )), Times.Once());
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:28,代码来源:NotifyAssignedVolunteersForTheTaskShould.cs


示例9: Register

        public async Task<IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser
                {
                    UserName = model.Email,
                    Email = model.Email,
                    TimeZoneId = _generalSettings.Value.DefaultTimeZone
                };

                var result = await _userManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);
                    var callbackUrl = Url.Action(new UrlActionContext { Action = nameof(ConfirmEmail), Controller = "Admin", Values = new { userId = user.Id, token = token }, Protocol = Request.Scheme });
                    await _mediator.SendAsync(new SendConfirmAccountEmail { Email = model.Email, CallbackUrl = callbackUrl });
                    return RedirectToAction(nameof(DisplayEmail), "Admin");
                }

                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:26,代码来源:AdminController.cs


示例10: SetsTaskSignupViewModel_WithTheCorrectData

        public async Task SetsTaskSignupViewModel_WithTheCorrectData()
        {
            var options = CreateNewContextOptions();

            var appUser = new ApplicationUser
            {
                Id = "asdfasasdfaf",
                Email = "[email protected]",
                FirstName = "Foo",
                LastName = "Bar",
                PhoneNumber = "555-555-5555",
            };

            var message = new ShowEventQuery { EventId = 1, UserId = appUser.Id };

            using (var context = new AllReadyContext(options))
            {
                context.Users.Add(appUser);
                context.Events.Add(CreateAllReadyEventWithTasks(message.EventId, appUser));
                await context.SaveChangesAsync();
            }

            using (var context = new AllReadyContext(options))
            {
                var sut = new ShowEventQueryHandler(context);
                var eventViewModel = await sut.Handle(message);

                Assert.Equal(message.EventId, eventViewModel.SignupModel.EventId);
                Assert.Equal(appUser.Id, eventViewModel.SignupModel.UserId);
                Assert.Equal($"{appUser.FirstName} {appUser.LastName}", eventViewModel.SignupModel.Name);
            }
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:32,代码来源:ShowEventQueryHandlerShould.cs


示例11: RedirectToCorrectActionResultWithCorrectRouteValues_WhenReturnUrlIsNotALocalUrl_AndUserIsOrgAdmin

        public void RedirectToCorrectActionResultWithCorrectRouteValues_WhenReturnUrlIsNotALocalUrl_AndUserIsOrgAdmin()
        {
            var applicationUser = new ApplicationUser();
            applicationUser.MakeOrgAdmin();
            //applicationUser.Claims.Add(new IdentityUserClaim<string>
            //{
            //    ClaimType = AllReady.Security.ClaimTypes.UserType,
            //    ClaimValue = Enum.GetName(typeof(UserType), UserType.OrgAdmin)
            //});

            var urlHelper = new Mock<IUrlHelper>();
            urlHelper.Setup(x => x.IsLocalUrl(It.IsAny<string>())).Returns(false);

            var routeValueDictionary = new RouteValueDictionary
            {
                ["area"] = "Admin"
            };

            var sut = new RedirectAccountControllerRequests();
            var result = sut.RedirectToLocal(It.IsAny<string>(), applicationUser, urlHelper.Object) as RedirectToActionResult;

            Assert.Equal(result.ActionName, nameof(AllReady.Areas.Admin.Controllers.CampaignController.Index));
            Assert.Equal(result.ControllerName, "Campaign");
            Assert.Equal(result.RouteValues, routeValueDictionary);
        }
开发者ID:ChrisDobby,项目名称:allReady,代码行数:25,代码来源:RedirectAccountControllerRequestsShould.cs


示例12: InvokeUpdateTaskSignupAsyncForEachTaskSignupViewModelOnCommand

        public async Task InvokeUpdateTaskSignupAsyncForEachTaskSignupViewModelOnCommand()
        {
            var options = CreateNewContextOptions();

            const string userId = "1";
            const int firstId = 1;
            const int secondId = 2;

            var user = new ApplicationUser {Id = userId};
            var taskSignupViewModels = new List<TaskSignupViewModel> {new TaskSignupViewModel {Id = firstId}, new TaskSignupViewModel {Id = secondId}};

            using (var context = new AllReadyContext(options))
            {
                context.Users.Add(user);
                context.TaskSignups.Add(new TaskSignup { Id = firstId });
                context.TaskSignups.Add(new TaskSignup { Id = secondId });
                await context.SaveChangesAsync();
            }

            using (var context = new AllReadyContext(options))
            {
                var sut = new UpdateMyTasksCommandHandler(context) { DateTimeUtcNow = () => DateTime.UtcNow };
                await sut.Handle(new UpdateMyTasksCommand { TaskSignups = taskSignupViewModels });
            }

            using (var context = new AllReadyContext(options))
            {
                var signup1 = context.TaskSignups.FirstOrDefault(x => x.Id == firstId);
                Assert.Equal(signup1 != null, true);
                var signup2 = context.TaskSignups.FirstOrDefault(x => x.Id == secondId);
                Assert.Equal(signup2 != null, true);
            }
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:33,代码来源:UpdateMyTasksHandlerShould.cs


示例13: SetsEventSignupViewModel_WithTheCorrectData

        public void SetsEventSignupViewModel_WithTheCorrectData()
        {
            var appUser = new ApplicationUser()
            {
                Id = "asdfasasdfaf",
                Email = "[email protected]",
                FirstName = "Foo",
                LastName = "Bar",
                PhoneNumber = "555-555-5555",
            };
            var message = new ShowEventQuery() { EventId = 1, User = new ClaimsPrincipal() };
            var dataAccess = new Mock<IAllReadyDataAccess>();
            var userManager = CreateUserManagerMock();
            userManager.Setup(x => x.GetUserId(message.User)).Returns(appUser.Id);
            dataAccess.Setup(x => x.GetUser(appUser.Id)).Returns(appUser);
            dataAccess.Setup(x => x.GetEvent(message.EventId)).Returns(CreateAllReadyEventWithTasks(message.EventId, appUser));

            var sut = new ShowEventQueryHandler(dataAccess.Object, userManager.Object);
            var eventViewModel = sut.Handle(message);

            Assert.Equal(message.EventId, eventViewModel.SignupModel.EventId);
            Assert.Equal(appUser.Id, eventViewModel.SignupModel.UserId);
            Assert.Equal($"{appUser.FirstName} {appUser.LastName}", eventViewModel.SignupModel.Name);
            Assert.Equal(appUser.Email, eventViewModel.SignupModel.PreferredEmail);
            Assert.Equal(appUser.PhoneNumber, eventViewModel.SignupModel.PreferredPhoneNumber);
        }
开发者ID:gftrader,项目名称:allReady,代码行数:26,代码来源:ShowEventQueryHandlerShould.cs


示例14: LoadTestData

        protected override async Task LoadTestData()
        {
            var userId = "foo_id";
            var userName = "foo_user";

            var testuser = new ApplicationUser() { UserName = userName, Email = userName, Id = userId };
            var createResult = await UserManager.CreateAsync(testuser);
        }
开发者ID:mmoore99,项目名称:allReady,代码行数:8,代码来源:DeleteUserCommandHandlerShould.cs


示例15: LoadTestData

        protected override void LoadTestData()
        {
            var htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Event()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            Context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            Context.Users.Add(user2);

            var task = new AllReadyTask
            {
                Id = 1,
                Name = "Task 1",
                Event = queenAnne,
            };

            var taskSignup = new TaskSignup
            {
                Id = 1,
                User = user1,
                Task = task
            };

            htb.Campaigns.Add(firePrev);            
            Context.Organizations.Add(htb);
            Context.Events.Add(queenAnne);
            Context.Tasks.Add(task);
            Context.TaskSignups.Add(taskSignup);

            Context.SaveChanges();
        }
开发者ID:ChrisDobby,项目名称:allReady,代码行数:58,代码来源:MessageEventVolunteersCommandHandlerTests.cs


示例16:

 Task IAllReadyDataAccess.UpdateUser(ApplicationUser value)
 {
     //First remove any skills that are no longer associated with this user
     var usksToRemove = _dbContext.UserSkills.Where(usk => usk.UserId == value.Id && (value.AssociatedSkills == null ||
         !value.AssociatedSkills.Any(usk1 => usk1.SkillId == usk.SkillId)));
     _dbContext.UserSkills.RemoveRange(usksToRemove);
     _dbContext.Users.Update(value);
     return _dbContext.SaveChangesAsync();
 }
开发者ID:mmoore99,项目名称:allReady,代码行数:9,代码来源:AllReadyDataAccessEF7.ApplicationUser.cs


示例17: LoadTestData

        protected override void LoadTestData()
        {
            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true, NormalizedUserName =  username1.ToUpperInvariant() };
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true, NormalizedUserName = username2.ToUpperInvariant() };
            Context.Users.Add(user1);
            Context.Users.Add(user2);
            Context.SaveChanges();
        }
开发者ID:ultrabert,项目名称:allReady,代码行数:11,代码来源:ApplicationUserQueryTests.cs


示例18: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            var htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Activity()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);            
            context.Organizations.Add(htb);
            context.Activities.Add(queenAnne);

            var activitySignups = new List<ActivitySignup>
            {
                new ActivitySignup { Activity = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow },
                new ActivitySignup { Activity = queenAnne, User = user2, SignupDateTime = DateTime.UtcNow }
            };

            context.ActivitySignup.AddRange(activitySignups);
            context.SaveChanges();
        }
开发者ID:ultrabert,项目名称:allReady,代码行数:50,代码来源:MessageVolunteers.cs


示例19: ReturnTheCorrectData

        public async Task ReturnTheCorrectData()
        {
            var applicationUser = new ApplicationUser { Id = "1", UserName = "UserName", EmailConfirmed = true };

            Context.Add(new ApplicationUser { Id = "1", UserName = "UserName", EmailConfirmed = true });
            Context.SaveChanges();

            var sut = new IndexQueryHandler(Context);
            var result = await sut.Handle(new IndexQuery());

            Assert.Equal(result.Users[0].Id, applicationUser.Id);
            Assert.Equal(result.Users[0].UserName, applicationUser.UserName);
            Assert.Equal(result.Users[0].EmailConfirmed, applicationUser.EmailConfirmed);
        }
开发者ID:HTBox,项目名称:allReady,代码行数:14,代码来源:IndexQueryHandlerShould.cs


示例20: AssignsVolunteersToTask

        public async Task AssignsVolunteersToTask()
        {
            var newVolunteer = new ApplicationUser { Id = "user1", Email = "[email protected]", PhoneNumber = "1234"};
            var task = new AllReadyTask { Id = 1 };
            Context.Add(newVolunteer);
            Context.Add(task);
            Context.SaveChanges();

            var message = new AssignTaskCommand { TaskId = task.Id, UserIds = new List<string> { newVolunteer.Id } };
            await sut.Handle(message);

            var taskSignup = Context.Tasks.Single(x => x.Id == task.Id).AssignedVolunteers.Single();
            Assert.Equal(taskSignup.User.Id, newVolunteer.Id);
            Assert.Equal(taskSignup.Status, TaskStatus.Assigned.ToString());
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:15,代码来源:AssignTaskCommandHandlerShould.cs



注:本文中的AllReady.Models.ApplicationUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.Campaign类代码示例发布时间:2022-05-24
下一篇:
C# Models.AllReadyTask类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap