public void AddPersonsSuccessTest()
        {
            var Input = new
            {
                persons = GeneratePeople(30).OrderBy(p => p.Id).ToList(),
                options = this.GenerateOptions("AddPersonsSuccessTest")
            };

            using (var context = new TestingContext(Input.options))
            {
                var repo = new PersonRepository(context);

                foreach (var person in Input.persons)
                {
                    repo.Insert(person);
                }

                context.SaveChanges();
            }

            List <Context.DataModels.Person> Actual;

            using (var context = new TestingContext(Input.options))
            {
                var Target = new PersonRepository(context);
                Actual = Target.Get(null, null).OrderBy(p => p.Id).ToList();
            }
            Actual.Should().BeEquivalentTo(Input.persons,
                                           op => op.Excluding(p => p.Address.Person)
                                           .Excluding(p => p.Company.Person),
                                           "the data had been saved and received from the database");
        }
        public void AddPersonSuccessTest()
        {
            var Input = new
            {
                person  = GeneratePeople(1).First(),
                options = this.GenerateOptions("AddPersonSuccessTest")
            };

            using (var context = new TestingContext(Input.options))
            {
                var repo = new PersonRepository(context);
                repo.Insert(Input.person);
                context.SaveChanges();
            }

            Context.DataModels.Person Actual;
            using (var context = new TestingContext(Input.options))
            {
                var Target = new PersonRepository(context);
                Actual = Target.GetFullPersonById(Input.person.Id);
            }

            Actual.Should().BeEquivalentTo(Input.person,
                                           op => op.Excluding(p => p.Address.Person)
                                           .Excluding(p => p.Company.Person),
                                           "the data should have been saved and received from the database");
        }
Ejemplo n.º 3
0
 public void It_should_return_a_correct_post()
 {
     Actual.Should().Be(ExpectedModel);
 }