Beispiel #1
0
        public void ModelConditions_ByNameNotContainsAwesome()
        {
            var models = Builder <Model>
                         .CreateListOfSize(5)
                         .TheFirst(3)
                         .With(o => o.Id  = Guid.NewGuid())
                         .And(o => o.Name = Faker.Company.Name())
                         .TheNext(1)
                         .With(o => o.Id  = Guid.NewGuid())
                         .And(o => o.Name = $"{Faker.Company.Name()} awesome")
                         .TheNext(1)
                         .With(o => o.Id  = Guid.NewGuid())
                         .And(o => o.Name = $"The awesome {Faker.Company.Name()}")
                         .Build();

            this.Get <IRepository>()
            .Setup(o => o.GetAllBy(It.IsAny <Expression <Func <Model, bool> > >()))
            .Returns(models);

            var awesomeModels = models
                                .Where(ModelQueries.ByNameNotContainsAwesome().Compile());

            Assert.AreEqual(3, awesomeModels.Count());
        }
Beispiel #2
0
        public void Service_GetAwesome_IsCalled()
        {
            var awesomeModels = _service.NOT_COVERED_CONDITION_GetAwesome();

            this.Get <IRepository>().Verify(o =>
                                            o.GetAllBy(
                                                It.Is <Expression <Func <Model, bool> > >(condition =>
                                                                                          Lambda.Eq(condition, ModelQueries.ByNameContainsAwesome())
                                                                                          )
                                                ),
                                            Moq.Times.Once());
        }