Beispiel #1
0
        public void SeedPeople()
        {
            var people = new PersonFake().GenerateList(10);

            _acervoContext.People.AddRange(people);
            _acervoContext.SaveChanges();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            PersonFake    pFakes = new PersonFake();
            List <Person> people = pFakes.Generate(1000);

            //VoorEnAchterBeginnendMetM(people);
            ProjectieAchterEnLeeftijd(people);
        }
        public void Should_ThrowPersonDoesNotExistException_When_RemovePersonDoesNotExist()
        {
            // Arrange
            var person = new PersonFake();

            // Act / Assert
            //Assert.Throws<PersonDoesNotExistException>((() => _personService.Remove(person.Id)));
        }
        public void Should_ThrowException_When_PersonAlreadyExists()
        {
            // Arrange
            var person = new PersonFake();

            // Act / Assert
            _personService.Create(person);

            Assert.Throws <PersonAlreadyExistsException>(() => _personService.Create(person));
        }
        public void Should_ReturnStatusCode201Created_When_CreatingPersonForFirstTime()
        {
            // Arrange
            var person = new PersonFake();

            // Action
            var httpStatusCode = _personController.Create(person);

            // Assert
            Assert.AreEqual(StatusCodes.Status201Created, httpStatusCode);
        }
        public void Should_RemovePersonSuccessfully_When_PersonExists()
        {
            // Arrange
            var person = new PersonFake();

            // Act
            _personService.Create(person);
            //_personService.Remove(person.Id);

            // Assert
            Assert.IsNull(_personService.Get(person.Id));
        }
        public void Should_UpdatePersonSuccessfully_When_PersonExists()
        {
            // Arrange
            var          person  = new PersonFake();
            const string newName = "Beatriz Lucena Suzuki";

            // Act
            _personService.Create(person);
            person.FullName = newName;
            _personService.Update(person);

            // Assert
            Assert.AreEqual(newName, person.FullName);
        }
        public void Should_CreatePersonSuccessfully()
        {
            // Arrange
            SetupMockHappyPath();

            var personFake = new PersonFake();

            // Act / Assert
            try
            {
                _personRepository.Create(personFake);
            }
            catch (Exception)
            {
                Assert.Fail();
            }

            _mockPersonRepository.Verify(x => x.InsertOne(personFake, null, default), Times.Once);

            Assert.Pass();
        }
Beispiel #9
0
        static PersonRepository()
        {
            PersonFake fk = new PersonFake();

            people = fk.Generate(500);
        }
 public void Should_ReadPersonSuccessfully()
 {
     // Arrange
     SetupMockHappyPath();
     var personFake = new PersonFake();
 }