コード例 #1
0
        public void Should_ReturnUser_When_EmailIsMatchingAndUserIsActive(string expectedEmail)
        {
            //Arrange
            var stubRepositoryFactory = A.RepositoryFactory()
                                        .ThatReturnsAFakeRepositoryWithTestEntities(
                TestDataFactory.CreateDataForUserRepository())
                                        .Build();

            var userServiceSut = new UserService(stubRepositoryFactory);

            //Act
            var resultUser = userServiceSut.FindUserByEmail(expectedEmail);


            //Assert
            Assert.Equal(expectedEmail, resultUser.Email);
        }
コード例 #2
0
        public void Should_ReturnAllActiveEntities_When_GetAllActiveEntitiesIsCalled()
        {
            //Arrange
            var stubRepositoryFactory = A.RepositoryFactory().ThatReturnsAFakeRepositoryWithTestEntities(TestDataFactory.CreateDataForUserRepository()).Build();

            var userServiceSut = new UserService(stubRepositoryFactory);

            //Act
            var resultUsers = userServiceSut.GetAllUsers();

            var containsAllActiveEntities = resultUsers.All(u => u.Active);

            //Assert
            Assert.Equal(true, containsAllActiveEntities);
        }