Пример #1
0
        public async Task Should_Return_Created_Event_With_Wall()
        {
            MockUsers();
            MockEventTypes();
            var newEvent = new CreateEventDto
            {
                EndDate   = DateTime.UtcNow.AddHours(2),
                StartDate = DateTime.UtcNow.AddHours(1),
                Name      = "Name",
                TypeId    = 1,
                ImageName = "qwer",
                Offices   = new EventOfficesDto {
                    Value = "[\"1\"]", OfficeNames = new List <string> {
                        "office"
                    }
                },
                Recurrence        = EventRecurrenceOptions.EveryDay,
                MaxOptions        = 0,
                MaxParticipants   = 1,
                OrganizationId    = 1,
                ResponsibleUserId = "1",
                Location          = "place",
                NewOptions        = new List <NewEventOptionDto>()
            };

            await _eventService.CreateEventAsync(newEvent);

            await _wallService.Received(1)
            .CreateNewWallAsync(Arg.Is <CreateWallDto>(x =>
                                                       x.Name == newEvent.Name &&
                                                       x.Access == WallAccess.Private &&
                                                       x.Type == WallType.Events &&
                                                       x.ModeratorsIds.Count() == 1 &&
                                                       x.ModeratorsIds.Any(y => y == newEvent.ResponsibleUserId)));
        }