Exemple #1
0
        public override void SaveEntity_EntityIsNew_EntityIsCreated()
        {
            var title = TitleCommands.SaveTitle(new Title {
                Description = RandomUtil.GetRandomString()
            }, Context);

            Assert.IsNotNull(title.IdTitle);
        }
Exemple #2
0
        public override void GetEntityById_EntityDoesExist_ReturnsEntity()
        {
            var title = TitleCommands.SaveTitle(new Title {
                Description = RandomUtil.GetRandomString()
            }, Context);

            Assert.IsNotNull(TitleQueries.GetTitleById(Context, title.IdTitle));
        }
Exemple #3
0
        public void GetTitleByPartOfDescription_ReturnsListOfTitles()
        {
            var description = RandomUtil.GetRandomString(25);

            TitleCommands.SaveTitle(new Title {
                Description = description
            }, Context);
            var titles = TitleQueries.GetTitlesByPartOfDescription(Context,
                                                                   description.Substring(RandomUtil.GetRandomNumber(1), RandomUtil.GetRandomNumber(1) + 1));

            Assert.IsNotEmpty(titles);
            Assert.IsNotNull(titles.Where(t => t.Description.Contains(description)));
        }
Exemple #4
0
        public override void SaveEntity_EntityIsNew_EntityIsCreated()
        {
            var person = PersonCommands.SavePerson(new Person
            {
                FirstName = RandomUtil.GetRandomString(),
                LastName  = RandomUtil.GetRandomString()
            }, Context);
            var title = TitleCommands.SaveTitle(new Title {
                Description = RandomUtil.GetRandomString()
            }, Context);
            var personTitle = PersonTitleCommands.SavePersonTitle(new PersonTitle {
                IdPerson = person.IdPerson, IdTitle = title.IdTitle
            }, Context);

            Assert.IsNotNull(personTitle);
        }
Exemple #5
0
        public override void SaveEntity_EntityExists_EntityIsUpdated()
        {
            var description = RandomUtil.GetRandomAlphaNumericString(25);
            var title       = TitleCommands.SaveTitle(new Title {
                Description = description
            }, Context);
            var newDescription = RandomUtil.GetRandomAlphaNumericString(30);

            title.Description = newDescription;
            title.SaveTitle(Context);

            var titleDb = TitleQueries.GetTitleById(Context, title.IdTitle);

            Assert.AreNotEqual(description, titleDb.Description);
            Assert.AreEqual(newDescription, titleDb.Description);
        }
Exemple #6
0
        public static PersonTitle CreatePersonTitle(FootBallContext context, out Person person, out Title title)
        {
            person = PersonCommands.SavePerson(
                new Person {
                FirstName = RandomUtil.GetRandomString(), LastName = RandomUtil.GetRandomString()
            },
                context);
            Assert.IsNotNull(person);

            title = TitleCommands.SaveTitle(new Title {
                Description = RandomUtil.GetRandomString()
            }, context);
            Assert.IsNotNull(title);

            return(PersonTitleCommands.SavePersonTitle(new PersonTitle {
                IdPerson = person.IdPerson, IdTitle = title.IdTitle
            },
                                                       context));
        }