Beispiel #1
0
        public async Task GetBasicSubmissionInfoByPersonId_GetsFromDb()
        {
            // Arrange
            ImageEntity imageEntity  = EntitiesHelper.GetImage();
            var         personEntity = EntitiesHelper.GetPerson();
            await submissionRepository.Add(new SubmissionEntity
            {
                Notes     = "test",
                SalonYear = EntitiesHelper.GetSalonYear(),
                Person    = personEntity,
                IsJudged  = true,
                Entries   = new List <CompetitionEntryEntity>
                {
                    new CompetitionEntryEntity
                    {
                        Image      = imageEntity,
                        Section    = EntitiesHelper.GetSection(),
                        IsAccepted = true,
                        IsAwarded  = false,
                        Score      = 50
                    },
                    new CompetitionEntryEntity
                    {
                        Image   = imageEntity,
                        Section = EntitiesHelper.GetSection(),
                    }
                }
            });

            await submissionRepository.Add(new SubmissionEntity
            {
                Notes     = "test",
                SalonYear = EntitiesHelper.GetSalonYear(),
                Person    = personEntity,
                Entries   = new List <CompetitionEntryEntity>
                {
                    new CompetitionEntryEntity
                    {
                        Image      = imageEntity,
                        Section    = EntitiesHelper.GetSection(),
                        IsAccepted = true,
                        IsAwarded  = false,
                        Score      = 50
                    },
                    new CompetitionEntryEntity
                    {
                        Image   = imageEntity,
                        Section = EntitiesHelper.GetSection(),
                    }
                }
            });

            // Act
            var lResult = await submissionRepository.GetBasicSubmissionInfoByPersonId(personEntity.Id);

            // Assert
            Assert.IsNotNull(lResult);
            Assert.AreEqual(2, lResult.Count);
            Assert.IsTrue(lResult[0].SubmissionId > 0);
            Assert.IsTrue(lResult[0].IsJudged);
            Assert.IsTrue(!string.IsNullOrWhiteSpace(lResult[0].DisplayName));
            Assert.AreEqual(2, lResult[0].NumberOfEntries);
        }