예제 #1
0
        public async void UpdateMarca()
        {
            //Arrange
            var marca = new Faker <Marca>("pt_BR")
                        .RuleFor(m => m.Id, f => f.Random.Short(1, 100))
                        .RuleFor(m => m.Nome, f => f.Company.CompanyName())
                        .RuleFor(m => m.Ativo, f => f.Random.Bool())
                        .RuleFor(m => m.DataCriacao, f => f.Date.Recent())
                        .Generate(1)[0];

            //Act
            var actual = await controller.Put(marca.Id, marca);

            //Assert
            actual.GetType().GetProperty("StatusCode").GetValue(actual).Should().BeEquivalentTo(200);
            mocker.GetMock <IRepositoryBase <Marca> >().Verify(m => m.Update(marca), Times.Once);
            mocker.GetMock <IUnitOfWork>().Verify(u => u.Commit(), Times.Once);
        }