예제 #1
0
        public async void GetMarcasShouldNotBeNull()
        {
            //Arrange
            var expected = 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(5);

            mocker.GetMock <IRepositoryBase <Marca> >().Setup(_ => _.GetAll()).ReturnsAsync(expected);

            //Act
            var actual = await controller.Get();

            //Assert
            actual.GetType().GetProperty("Value").GetValue(actual).Should().BeEquivalentTo(expected);
            actual.GetType().GetProperty("StatusCode").GetValue(actual).Should().BeEquivalentTo(200);
        }