Exemplo n.º 1
0
        public void ShouldSearch()
        {
            var artService = new ArticleService(rep, "http://localhost/fwd/entity/type-article/id-{0}");
            var res        = artService.GetBySearchString("Хабр", c => c.ArticleName, 0, 1, "http://localhost/fwd/entity/type-article/id-{0}");

            res.Count().Should(Be.GreaterThan(0));
        }
Exemplo n.º 2
0
        public void GetCounts()
        {
            var rep     = new TransactionDBRepository();
            var service = new TransactionService(rep);
            var t       = service.GetTrancCount();

            t.Item1.Should(Be.GreaterThan(0));
            t.Item2.Should(Be.GreaterThan(0));
            t.Item3.Should(Be.GreaterThan(0));
        }
Exemplo n.º 3
0
        public void ShouldGetBySearchString()
        {
            string searchString = "C#";
            var    res          = rep.GetByPredicate(c => c.ArticleName.ToUpper().Contains(searchString.ToUpper()) ||
                                                     c.AuthorName.ToUpper().Contains(searchString.ToUpper()) ||
                                                     c.InitialText.ToUpper().Contains(searchString.ToUpper()) ||
                                                     c.Tags.FirstOrDefault(x => x.Name.ToUpper().Contains(searchString.ToUpper())) != null, null);


            res.Count().Should(Be.GreaterThan(0));
        }
        public FakeValidator()
        {
            //TOOD: This is not working. - One error is in the BasicJsonRule - When we select an item, if there is no items, we have a empty result.
            When(Field("gender", Is.Defined()) | Field("sex", Is.Defined()))
            .Then(Field("gender", Must.Be.In("male", "female")) | Field("sex", Must.Be.In("male", "female")));
            //When("gender", Is.Defined()).Then(Field("gender", Must.Be.In("male", "female")) | Field("sex", Must.Be.In("male", "female")));

            When("name", Is.Defined()).Then(It, Must.Have.LengthBetween(10, 50) & Must.Match("^[A-Za-z\\s]+$") | Have.ExactLength(5));
            When("age", Is.Defined()).Then(It, Must.Be.Integer() & Be.GreaterThan(0));
            When(Any).Then("fox", Is.Required());

            //When("missing", Is.Defined()).Then(It, Must.Be.Boolean());
        }
Exemplo n.º 5
0
        public void can_get_all_clide_templates_in_a_given_directory()
        {
            Template.All.Count.ShouldEqual(0);

            Environment.SetEnvironmentVariable("CLIDE_TEMPLATES", Example("templates"));

            Template.All.Count.Should(Be.GreaterThan(0));

            var basic = Template.Get("basic");

            basic.Name.ShouldEqual("basic");
            basic.Description.ShouldEqual("Create basic something or other");
            basic.Usage.ShouldEqual("Usage:\n  clide gen basic Name [Foo=] [Bar=]\n\nSome info\n\nDescription:\n    Create basic something or other\n\nMore shit\n");
        }
Exemplo n.º 6
0
        public void GetBySearchParameters()
        {
            var rep     = new TransactionDBRepository();
            var service = new TransactionService(rep);

            var result = service.GetTransactionBySearchParams(0, 10, "Description", "Статья");

            result.Item2.Count().Should(Be.GreaterThan(0));

            result = service.GetTransactionBySearchParams(0, 10, "Id", "1");
            result.Item2.Count().Should(Be.EqualTo(1));

            //result = service.GetTransactionBySearchParams(0, 10, "ActionDateTime", "26.03.2015, 20:22:47");
            //result.Count().Should(Be.EqualTo(1));
        }
Exemplo n.º 7
0
        public void ShouldSave()
        {
            var id = rep.Save(plan);

            id.Should(Be.GreaterThan(0));
        }