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

C# Models.Event类代码示例

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

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



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

示例1: InitialRequestConfirmationsSentHandler

        public async Task ScheduleISendRequestConfirmationMessagesSevenDaysBeforeAnItineraryDateWithTheCorrectMethodSignatureAndTheCorrectDate()
        {
            var dateTimeNow = DateTime.Today;
            var dateTimeNowUnspecified = DateTime.SpecifyKind(dateTimeNow, DateTimeKind.Unspecified);

            var requestId = Guid.NewGuid();
            var message = new InitialRequestConfirmationsSent { ItineraryId = 1, RequestIds = new List<Guid> { requestId } };
            var @event = new Event { Id = 1, TimeZoneId = "Eastern Standard Time" };
            var itinerary = new Itinerary { Id = 1, Date = dateTimeNowUnspecified, EventId = @event.Id, Event = @event };

            Context.Requests.Add(new Request { RequestId = requestId });
            Context.Itineraries.Add(itinerary);
            Context.Events.Add(@event);
            Context.SaveChanges();

            var backgroundJobClient = new Mock<IBackgroundJobClient>();
            var sut = new InitialRequestConfirmationsSentHandler(Context, backgroundJobClient.Object);
            await sut.Handle(message);

            backgroundJobClient.Verify(x => x.Create(It.Is<Job>(job =>
                job.Type == typeof(ISendRequestConfirmationMessagesSevenDaysBeforeAnItineraryDate) &&
                job.Method.Name == nameof(ISendRequestConfirmationMessagesSevenDaysBeforeAnItineraryDate.SendSms) &&
                job.Args[0] == message.RequestIds &&
                (int)job.Args[1] == message.ItineraryId),
                It.Is<ScheduledState>(ss => ss.EnqueueAt.Date.AddHours(12) == itinerary.Date.Date.AddDays(-7).AddHours(12))), Times.Once);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:26,代码来源:InitialRequestConfirmationsSentHandlerShould.cs


示例2: SendRequestConfirmationsToTheCorrectPhoneNumberWithTheCorrectMessage_WhenRequestIdsMatchExistingRequests_AndThoseRequestsHaveAStatusOfPendingConfirmation_AndTodayIsTheSameDateAsTheItineraryDate

        public void SendRequestConfirmationsToTheCorrectPhoneNumberWithTheCorrectMessage_WhenRequestIdsMatchExistingRequests_AndThoseRequestsHaveAStatusOfPendingConfirmation_AndTodayIsTheSameDateAsTheItineraryDate()
        {
            var dateTimeNow = DateTime.Today;
            var dateTimeNowUnspecified = DateTime.SpecifyKind(dateTimeNow, DateTimeKind.Unspecified);
            var dateTimeUtcNow = DateTime.SpecifyKind(dateTimeNow, DateTimeKind.Utc);

            var requestorPhoneNumbers = new List<string> { "111-111-1111" };

            var @event = new Event { Id = 1, TimeZoneId = "Eastern Standard Time" };
            var itinerary = new Itinerary { Id = 1, Date = dateTimeNowUnspecified.Date, EventId = @event.Id, Event = @event };
            var request = new Request { RequestId = Guid.NewGuid(), Status = RequestStatus.PendingConfirmation, Phone = requestorPhoneNumbers[0] };

            var requestIds = new List<Guid> { request.RequestId };
            var smsSender = new Mock<ISmsSender>();

            Context.Requests.Add(request);
            Context.Itineraries.Add(itinerary);
            Context.Events.Add(@event);
            Context.SaveChanges();

            var sut = new SendRequestConfirmationMessagesTheDayOfAnItineraryDate(Context, smsSender.Object, Mock.Of<IMediator>())
            {
                DateTimeUtcNow = () => dateTimeUtcNow.Date
            };
            sut.SendSms(requestIds, itinerary.Id);

            smsSender.Verify(x => x.SendSmsAsync(requestorPhoneNumbers, "sorry you couldn't make it, we will reschedule."));
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:28,代码来源:SendRequestConfirmationMessagesTheDayOfAnItineraryDateShould.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: GetCampaignsByPostalCodeReturnsCorrectResults

        public void GetCampaignsByPostalCodeReturnsCorrectResults()
        {
            var event1 = new Event { Id = 1, CampaignId = 1 };
            event1.Campaign = new Campaign { Id = 1, Events = new List<Event> { event1 }, ManagingOrganization = new Organization() };

            var event2 = new Event { Id = 2 };
            var event3 = new Event { Id = 3 };
            var campaign2 = new Campaign { Id = 2, Events = new List<Event> { event2, event3 }, ManagingOrganization = new Organization() };

            event2.CampaignId = campaign2.Id;
            event2.Campaign = campaign2;

            event3.CampaignId = campaign2.Id;
            event3.Campaign = campaign2;

            var allEvents = new List<Event> { event1, event2, event3 };

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.Send(It.IsAny<EventsByPostalCodeQuery>())).Returns(allEvents);

            var sut = new CampaignApiController(mediator.Object);
            var results = sut.GetCampaignsByPostalCode(It.IsAny<string>(), It.IsAny<int>());

            Assert.Equal(results.Count(), allEvents.Count);
        }
开发者ID:shawnwildermuth,项目名称:allReady,代码行数:25,代码来源:CampaignApiControllerTests.cs


示例5: 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
            };
            htb.Campaigns.Add(firePrev);

            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>()
            };

            context.Organizations.Add(htb);
            context.Events.Add(queenAnne);
            context.SaveChanges();
        }
开发者ID:shawnwildermuth,项目名称:allReady,代码行数:35,代码来源:DeleteEventCommandHandlerTests.cs


示例6: 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


示例7:

 Task IAllReadyDataAccess.UpdateEvent(Event value)
 {
     //First remove any skills that are no longer associated with this event
     var acsksToRemove = _dbContext.EventSkills.Where(acsk => acsk.EventId == value.Id && (value.RequiredSkills == null ||
         !value.RequiredSkills.Any(acsk1 => acsk1.SkillId == acsk.SkillId)));
     _dbContext.EventSkills.RemoveRange(acsksToRemove);
     _dbContext.Events.Update(value);
     return _dbContext.SaveChangesAsync();
 }
开发者ID:shawnwildermuth,项目名称:allReady,代码行数:9,代码来源:AllReadyDataAccessEF7.Event.cs


示例8: EventViewModel

        public void SetOrganizationIdAndOrganizationName_WhenConstructingWithNonNullCampaignAndNonNullManagingOrganization()
        {
            var campaign = new Campaign { ManagingOrganization = new Organization { Id = 1, Name = "OrgName" } };
            var @event = new Event { Campaign = campaign };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.OrganizationId, campaign.ManagingOrganization.Id);
            Assert.Equal(sut.OrganizationName, campaign.ManagingOrganization.Name);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:9,代码来源:EventViewModelShould.cs


示例9: SetCampaignIdCampaignNameAndTimeZoneId_WhenConstructingWithNonNullCampaign

        public void SetCampaignIdCampaignNameAndTimeZoneId_WhenConstructingWithNonNullCampaign()
        {
            var campaign = new Campaign { Id = 1, Name = "Campaignname", TimeZoneId = "CampaignTimeZoneId" };
            var @event = new Event { Campaign = campaign, TimeZoneId = "EventTimeZoneId" };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.CampaignId, campaign.Id);
            Assert.Equal(sut.CampaignName, campaign.Name);
            Assert.Equal(sut.TimeZoneId, @event.TimeZoneId);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:10,代码来源:EventViewModelShould.cs


示例10: UpdateExistingTaskSuccessfully

        public async Task UpdateExistingTaskSuccessfully()
        {
            var @event = new Event { Id = 3 };
            var organization = new Organization { Id = 4 };
            var task = new AllReadyTask
            {
                Id = 2,
                Name = "TaskName",
                Description = "TaskDescription",
                Event = @event,
                Organization = organization,
                StartDateTime = DateTimeOffset.Now,
                EndDateTime = DateTimeOffset.Now,
                NumberOfVolunteersRequired = 5,
                RequiredSkills = new List<TaskSkill> { new TaskSkill { SkillId = 5, Skill = new Skill { Id = 5, Name = "SkillName", Description = "SkillDescription" } } }
            };

            Context.Database.EnsureDeleted();
            Context.Events.Add(@event);
            Context.Organizations.Add(organization);
            Context.Tasks.Add(task);
            Context.SaveChanges();

            var message = new EditTaskCommandAsync
            {
                Task = new EditViewModel
                {
                    Id = task.Id,
                    Name = "TaskNameUpdated",
                    Description = "TaskDescriptionUpdated",
                    EventId = @event.Id,
                    OrganizationId = organization.Id,
                    TimeZoneId = "Central Standard Time",
                    StartDateTime = DateTimeOffset.Now.AddDays(1),
                    EndDateTime = DateTimeOffset.Now.AddDays(2),
                    NumberOfVolunteersRequired = 6,
                    RequiredSkills = new List<TaskSkill> { new TaskSkill { SkillId = 6, Skill = new Skill { Id = 6, Name = "SkillNameOnMessage", Description = "SkillDescriptionOnMessage" } } }
                }
            };

            var sut = new EditTaskCommandHandlerAsync(Context);
            var taskId = await sut.Handle(message);
            var result = Context.Tasks.Single(x => x.Id == taskId);

            //can't test start and end date as they're tied to static classes
            Assert.Equal(taskId, message.Task.Id);
            Assert.Equal(result.Name, message.Task.Name);
            Assert.Equal(result.Description, message.Task.Description);
            Assert.Equal(result.Event, @event);
            Assert.Equal(result.Organization, organization);
            Assert.Equal(result.NumberOfVolunteersRequired, message.Task.NumberOfVolunteersRequired);
            Assert.Equal(result.IsLimitVolunteers, @event.IsLimitVolunteers);
            Assert.Equal(result.IsAllowWaitList, @event.IsAllowWaitList);
            Assert.Equal(result.RequiredSkills, message.Task.RequiredSkills);
        }
开发者ID:mheggeseth,项目名称:allReady,代码行数:55,代码来源:EditTaskCommandHandlerAsyncShould.cs


示例11: EventsByApplicationUserIdQueryHandlerShould

        public EventsByApplicationUserIdQueryHandlerShould()
        {
            message = new EventsByApplicationUserIdQuery { ApplicationUserId = Guid.NewGuid().ToString() };
            @event = new Event { Organizer = new ApplicationUser {Id = message.ApplicationUserId } };


            Context.Add(@event);
            Context.SaveChanges();

            sut = new EventsByApplicationUserIdQueryHandler(Context);
        }
开发者ID:HTBox,项目名称:allReady,代码行数:11,代码来源:EventsByApplicationUserIdQueryHandlerShould.cs


示例12: LoadTestData

        protected override void LoadTestData()
        {
            Context.Users.Add(new ApplicationUser { Id = "abc" });

            var campaignEvent = new Event { Id = 1, Name = "Some Event" };
            Context.Events.Add(campaignEvent);

            Context.Tasks.Add(new AllReadyTask { Id = 1, Name = "Closed Task", EndDateTime = DateTime.UtcNow.AddDays(-100), Event = campaignEvent });
            Context.Tasks.Add(new AllReadyTask { Id = 2, Name = "Open Task", EndDateTime = DateTime.UtcNow.AddDays(100), Event = campaignEvent });

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


示例13: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();

            var seattlePostalCode = new PostalCodeGeo { City = "Seattle", PostalCode = "98117", State = "WA" };
            var seattle = new Location
            {
                Id = 1,
                Address1 = "123 Main Street",
                Address2 = "Unit 2",
                City = "Seattle",
                PostalCode = seattlePostalCode,
                Country = "USA",
                State = "WA",
                Name = "Organizer name",
                PhoneNumber = "555-555-5555"                            
            };
         

            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
            };
            htb.Campaigns.Add(firePrev);

            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>()
            };

            context.PostalCodes.Add(seattlePostalCode);
            context.Locations.Add(seattle);
            context.Organizations.Add(htb);
            context.Events.Add(queenAnne);
            context.SaveChanges();
        }
开发者ID:pottereric,项目名称:allReady,代码行数:52,代码来源:EventDetailQueryHandlerTests.cs


示例14: ReturnCorrectViewModel

        public async Task ReturnCorrectViewModel()
        {
            var @event = new Event { Campaign = new Campaign { ManagingOrganization = new Organization { Id = 1 }}};
            Context.Events.Add(@event);
            await Context.SaveChangesAsync();

            var message = new OrganizationIdByEventIdQuery { EventId = @event.Id };

            var sut = new OrganizationIdByEventIdQueryHandler(Context);
            var result = await sut.Handle(message);

            Assert.Equal(result, @event.Campaign.ManagingOrganization.Id);
        }
开发者ID:HTBox,项目名称:allReady,代码行数:13,代码来源:OrganizationIdByEventIdQueryHandlerShould.cs


示例15: LoadTestData

        protected override void LoadTestData()
        {
            var user = new ApplicationUser { Id = "abc" };
            Context.Users.Add(user);

            var campaignEvent = new Event { Id = 1, Name = "Some Event" };
            Context.Events.Add(campaignEvent);

            var @task = new AllReadyTask { Id = 1, Name = "Some Task", EndDateTime = DateTime.UtcNow.AddDays(100), Event = campaignEvent };
            Context.Tasks.Add(@task);
           
            Context.TaskSignups.Add(new TaskSignup { Task = @task, User = user });
        
            Context.SaveChanges();
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:15,代码来源:TaskUnenrollHandlerShould.cs


示例16: ReturnCorrectErrorWhenModelsStartDateTimeIsLessThanParentEventStartDate

        public async System.Threading.Tasks.Task ReturnCorrectErrorWhenModelsStartDateTimeIsLessThanParentEventStartDate()
        {
            var now = DateTimeOffset.Now;

            var @event = new Event { Campaign = new Campaign { TimeZoneId = "UTC", }, TimeZoneId = "UTC", StartDateTime = now.AddDays(1), EndDateTime = now.AddDays(-1) };

            var mockMediator = new Mock<IMediator>();
            mockMediator.Setup(x => x.SendAsync(It.IsAny<EventByEventIdQuery>())).ReturnsAsync(@event);
            
            var validator = new TaskEditViewModelValidator(mockMediator.Object);
            var errors = await validator.Validate(new EditViewModel());

            Assert.True(errors.Exists(x => x.Key.Equals("StartDateTime")));
            Assert.Equal(errors.Find(x => x.Key == "StartDateTime").Value, String.Format("Start date cannot be earlier than the event start date {0:g}.", @event.StartDateTime));
        }
开发者ID:dpaquette,项目名称:allReady,代码行数:15,代码来源:TaskEditViewModelValidatorShould.cs


示例17: 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
            };
            htb.Campaigns.Add(firePrev);

            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>(),
                EventType = EventType.Itinerary
            };

            var itinerary = new Itinerary
            {
                Event = queenAnne,
                Name = "1st Itinerary",
                Id = 1,
                Date = new DateTime(2016, 07, 01)
            };

            var taskSignUp = new TaskSignup { Id = 1, ItineraryId = 2, TaskId = 1 };

            Context.Organizations.Add(htb);
            Context.Campaigns.Add(firePrev);
            Context.Events.Add(queenAnne);
            Context.Itineraries.Add(itinerary);
            Context.TaskSignups.Add(taskSignUp);

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


示例18: ReturnCorrectData

        public async Task ReturnCorrectData()
        {
            var @event = new Event { Id = 1, Campaign = new Campaign { Id = 1, Name = "CampaignName", ManagingOrganization = new Organization { Id = 1 }}};
            Context.Events.Add(@event);
            Context.SaveChanges();

            var sut = new DeleteQueryHandler(Context);
            var result = await sut.Handle(new DeleteQuery { EventId = @event.Id });

            Assert.Equal(result.Id, @event.Id);
            Assert.Equal(result.Name, @event.Name);
            Assert.Equal(result.CampaignId, @event.Campaign.Id);
            Assert.Equal(result.CampaignName, @event.Campaign.Name);
            Assert.Equal(result.OrganizationId, @event.Campaign.ManagingOrganization.Id);
            Assert.Equal(result.StartDateTime, @event.StartDateTime);
            Assert.Equal(result.EndDateTime, @event.EndDateTime);
        }
开发者ID:HTBox,项目名称:allReady,代码行数:17,代码来源:DeleteQueryHandlerShould.cs


示例19: CreateTaskQueryHandlerAsyncShould

        public CreateTaskQueryHandlerAsyncShould()
        {
            @event = new Event
            {
                Id = 1,
                Name = "EventName",
                StartDateTime = DateTimeOffset.Now,
                EndDateTime = DateTimeOffset.Now,
                Campaign = new Campaign { StartDateTime = DateTimeOffset.Now, EndDateTime = DateTimeOffset.Now, Name = "CampaignName", ManagingOrganizationId = 2, TimeZoneId = "Central Standard Time" }
            };

            Context.Add(@event);
            Context.SaveChanges();

            message = new CreateTaskQueryAsync { EventId = @event.Id };
            sut = new CreateTaskQueryHandlerAsync(Context);
        }
开发者ID:mheggeseth,项目名称:allReady,代码行数:17,代码来源:CreateTaskQueryHandlerAsyncShould.cs


示例20: InvokeGetDateTimeOffsetWithCorrectParametersForEndDate

        public async System.Threading.Tasks.Task InvokeGetDateTimeOffsetWithCorrectParametersForEndDate()
        {
            var now = DateTimeOffset.Now;

            var model = new EditViewModel { EventId = 1, StartDateTime = now, EndDateTime = now };
            var @event = new Event { Campaign = new Campaign { TimeZoneId = "UTC" } };

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.IsAny<EventByEventIdQuery>())).ReturnsAsync(@event);

            var dateTimeOffsetProvider = new Mock<IConvertDateTimeOffset>();

            var sut = new TaskEditViewModelValidator(mediator.Object, dateTimeOffsetProvider.Object);
            await sut.Validate(model);

            dateTimeOffsetProvider.Verify(x => x.ConvertDateTimeOffsetTo(@event.Campaign.TimeZoneId, model.EndDateTime, model.EndDateTime.Hour,
                model.EndDateTime.Minute, 0));
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:18,代码来源:TaskEditViewModelValidatorShould.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Models.Organization类代码示例发布时间:2022-05-24
下一篇:
C# Models.Campaign类代码示例发布时间: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