コード例 #1
0
        public void GetUsersQueryHandler_Returns_Email_If_ShowEmail_Is_True()
        {
            var handler = new GetUsersQueryHandler(_context);
            var query   = new GetUsersQuery();

            _context.Users.Add(GetUser(1, UserStatus.Active, $"*****@*****.**", null, null, true));

            var results = handler.Execute(query);

            results.Single().Email.Should().Be("*****@*****.**");
        }
コード例 #2
0
        public void GetUsersQueryHandler_Returns_Anonymous_DisplayName_If_Not_Available()
        {
            var handler = new GetUsersQueryHandler(_context);
            var query   = new GetUsersQuery();

            _context.Users.Add(GetUser(1, UserStatus.Active, $"*****@*****.**", null, null, false));

            var results = handler.Execute(query);

            results.Single().DisplayName.Should().Be("Anonymous");
        }
コード例 #3
0
        public void GetUsersQueryHandler_Returns_Id()
        {
            var handler = new GetUsersQueryHandler(_context);
            var query   = new GetUsersQuery();

            _context.Users.Add(GetUser(1, UserStatus.Active, $"*****@*****.**", null, null, false));

            var results = handler.Execute(query);

            results.Single().Id.Should().Be(1);
        }
コード例 #4
0
        public void GetUsersQueryHandler_Returns_Null_StartDate_If_Not_Available()
        {
            var handler = new GetUsersQueryHandler(_context);
            var query   = new GetUsersQuery();

            _context.Users.Add(GetUser(1, UserStatus.Active, $"*****@*****.**", null, null, false));

            var results = handler.Execute(query);

            results.Single().StartDate.Should().BeNull();
        }
コード例 #5
0
        public void GetUsersQueryHandler_Returns_Description_If_Available()
        {
            var handler = new GetUsersQueryHandler(_context);
            var query   = new GetUsersQuery();

            _context.Users.Add(GetUser(1, UserStatus.Active, $"*****@*****.**", null, "A description", false));

            var results = handler.Execute(query);

            results.Single().Description.Should().Be("A description");
        }
コード例 #6
0
        public void GetUsersQueryHandler_Returns_All_Active_Users()
        {
            for (var i = 0; i < 9; i++)
            {
                _context.Users.Add(GetUser(i + 1, (UserStatus)(i % 3 + 1), $"test{i}@test.com", null, null, false, new DateTime(2019, 1, 1)));
            }

            var handler = new GetUsersQueryHandler(_context);
            var query   = new GetUsersQuery();

            var results = handler.Execute(query);

            results.Should().HaveCount(3);
        }