コード例 #1
0
        public async Task Should_ReturnEmptyList_When_PassValidCompanyId()
        {
            // Arrange
            var company = new Company()
            {
                CompanyId   = 4,
                CompanyName = "Test Company",
                CreatedAt   = DateTime.Now,
                CreatedBy   = -1
            };

            _fixture.Context.Add(company);
            _fixture.Context.SaveChanges();

            IRepository <User> repository = new Repository <User>(_fixture.Context);

            var handler = new GetUserListHandler(repository, _mapper, _logger);

            var request = new GetUserListQuery(companyId: 4);

            // Act
            var tcs = new CancellationToken();

            var response = await handler.Handle(request, tcs);

            // Assert
            Assert.Empty(response);
        }
コード例 #2
0
        public async Task Should_ReturnEmptyList_When_PassInvalidCompanyId()
        {
            // Arrange
            IRepository <User> repository = new Repository <User>(_fixture.Context);

            var handler = new GetUserListHandler(repository, _mapper, _logger);

            var request = new GetUserListQuery(companyId: -1);

            // Act
            var tcs = new CancellationToken();

            var response = await handler.Handle(request, tcs);

            // Assert
            Assert.Empty(response);
        }