Exemple #1
0
        public async Task GetAllAsyncShouldReturnOnlyUnAssignedGroupsToCurrentEventAndCreatedByCurrentCreatorWhenEventIdAndCreatorIdArePassed()
        {
            var creatorId = Guid.NewGuid().ToString();
            var eventId   = Guid.NewGuid().ToString();

            var firstGroupId = await this.CreateGroupAsync(null, "First Group");

            await this.AssignEventToGroupAsync(eventId, firstGroupId);

            var secondGroupId = await this.CreateGroupAsync(creatorId, "Second Group");

            var secondModel = new GroupAssignViewModel()
            {
                Id         = secondGroupId,
                Name       = "Second Group",
                CreatorId  = creatorId,
                IsAssigned = false,
            };

            var resultModelCollection = await this.Service.GetAllAsync <GroupAssignViewModel>(creatorId, eventId);

            Assert.Single(resultModelCollection);

            Assert.Equal(secondModel.Id, resultModelCollection.First().Id);
            Assert.Equal(secondModel.Name, resultModelCollection.First().Name);
            Assert.Equal(secondModel.CreatorId, resultModelCollection.First().CreatorId);
            Assert.False(resultModelCollection.First().IsAssigned);
        }
Exemple #2
0
        public async Task GetAllByEventIdAsyncShouldReturnCorrectModelCollection()
        {
            var eventId   = Guid.NewGuid().ToString();
            var creatorId = Guid.NewGuid().ToString();

            var firstGroupId = await this.CreateGroupAsync(creatorId, "First Group");

            var secondGroupId = await this.CreateGroupAsync(creatorId, "Second Group");

            await this.AssignEventToGroupAsync(eventId, firstGroupId);

            await this.AssignEventToGroupAsync(eventId, secondGroupId);

            var firstModel = new GroupAssignViewModel()
            {
                Id         = firstGroupId,
                Name       = "First Group",
                CreatorId  = creatorId,
                IsAssigned = false,
            };

            var secondModel = new GroupAssignViewModel()
            {
                Id         = secondGroupId,
                Name       = "Second Group",
                CreatorId  = creatorId,
                IsAssigned = false,
            };

            var resultModelCollection = await this.Service.GetAllByEventIdAsync <GroupAssignViewModel>(eventId);

            Assert.Equal(firstModel.Id, resultModelCollection.First().Id);
            Assert.Equal(firstModel.Name, resultModelCollection.First().Name);
            Assert.Equal(firstModel.CreatorId, resultModelCollection.First().CreatorId);
            Assert.False(resultModelCollection.First().IsAssigned);
            Assert.Equal(secondModel.Id, resultModelCollection.Last().Id);
            Assert.Equal(secondModel.Name, resultModelCollection.Last().Name);
            Assert.Equal(secondModel.CreatorId, resultModelCollection.Last().CreatorId);
            Assert.False(resultModelCollection.Last().IsAssigned);
            Assert.Equal(2, resultModelCollection.Count());
        }