public void AnyPredicateTrueTest()
        {
            Mock <UserEntity> otherEntity = new Mock <UserEntity>();

            otherEntity.SetupGet(e => e.Id).Returns(4);
            testRepo.Add(testEntity.Object);
            testRepo.Add(otherEntity.Object);
            bool any = testRepo.Any(u => u.Id == 4);

            Assert.IsTrue(any);
        }
Beispiel #2
0
        public bool IsNameTaken(string name)
        {
            name = name.ToLower().Trim().MultipleSpaceRemove();

            if (entityRepository.Any(entity =>
                                     entity.Name.ToLower().Trim() == name))
            {
                return(true);
            }

            return(reservedEntityNameRepository.Any(r =>
                                                    r.Name.ToLower().Trim() == name));
        }
Beispiel #3
0
        public async Task Get_Blogs_Any()
        {
            // Arrange

            // Act
            var hasAny = await _blogsRepository.Any(x => x.Posts.Count(y => y.Tags.Count == 2) > 4);

            // Assert
            Assert.True(hasAny);
        }
        public override void Validate(SendMessageViewModel model, ValidatorAction action = ValidatorAction.Undefined)
        {
            if (model.RecipientID.HasValue)
            {
                bool exists = entityRepository.Any(e => e.EntityID == model.RecipientID);

                if (!exists)
                {
                    AddError("Recipient does not exists", () => model.RecipientName);
                }
            }
            else
            {
                bool exists = entityRepository.Any(e => e.Name.ToLower() == model.RecipientName.ToLower());

                if (!exists)
                {
                    AddError("Recipient does not exists", () => model.RecipientName);
                }
            }
        }
Beispiel #5
0
 private static bool countryExists(CreateCountryParameters param)
 {
     return(entityRepository.Any(e => e.Name == param.CountryName));
 }