Exemplo n.º 1
0
        public async Task AddMemberToRole_TCI77_InvalidMemberMap()
        {
            //arrange
            var    memberMap = MemberMapTestUtils.GenerateValidMemberMap();
            string role      = "Member";

            //act
            await _sut.AddMemberToRole(memberMap as MemberMap, role);
        }
Exemplo n.º 2
0
        public async Task InsertAsyncTest_NullMember_ExceptionalCase()
        {
            //arrange
            _mapper.WithMap(MemberMapTestUtils.GenerateValidMemberMap());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.InsertAsync(null);
        }
Exemplo n.º 3
0
        public async Task InsertOneAsync_TCI44_HappyPath()
        {
            //arrange
            var memberMap = MemberMapTestUtils.GenerateValidMemberMap();

            //act
            var result = await _sut.InsertOneAsync(memberMap);

            //assert
            Assert.IsTrue(result);
        }
Exemplo n.º 4
0
        public async Task DeleteOneAsync_TCI57_InvalidMap()
        {
            //arrange
            var memberMap = MemberMapTestUtils.GenerateValidMemberMap();

            //act
            var result = await _sut.DeleteOneAsync(memberMap);

            //assert
            Assert.IsFalse(result);
        }
Exemplo n.º 5
0
        public async Task UpdateOneAsync_TCI48_InvalidMap()
        {
            //arrange
            var memberMap = MemberMapTestUtils.GenerateValidMemberMap();

            //act
            var result = await _sut.UpdateOneAsync(memberMap);

            //assert
            Assert.IsTrue(result);
        }
Exemplo n.º 6
0
        public async Task AddMemberToRole_TCI76_HappyPath()
        {
            //arrange
            var    memberMap = MemberMapTestUtils.GenerateValidMemberMap();
            string role      = "Member";

            //act
            var result = await _sut.AddMemberToRole(memberMap as MemberMap, role);

            //assert
            Assert.IsNotNull(result);
        }
Exemplo n.º 7
0
        public async Task IsInRole_NullMember_ExceptionalCase()
        {
            //arrange
            const string validRole = "validRole";

            _mapper.WithMap(MemberMapTestUtils.GenerateValidMemberMap());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.IsInRole(null, validRole);
        }
Exemplo n.º 8
0
        public async Task RemoveMemberFromRole_TCI84_NullRole()
        {
            //arrange
            var    memberMap = MemberMapTestUtils.GenerateValidMemberMap();
            string role      = null;

            //act
            var result = await _sut.RemoveMemberRole(memberMap as MemberMap, role);

            //assert
            Assert.IsNull(result);
        }
Exemplo n.º 9
0
        public async Task UpdateAsyncTest_ValidMember_HappyPath()
        {
            //arrange
            _mapper.WithMap(MemberMapTestUtils.GenerateValidMemberMap());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.UpdateAsync(MemberTestUtils.GenerateValidMember());

            //assert
            _access.Verify(m => m.UpdateOneAsync(It.IsAny <MemberMap>()), Times.Once);
        }
Exemplo n.º 10
0
        public async Task FindByUsername_NullMember_ExceptionalCase()
        {
            //arrange
            const string validUsername = "******";

            _access.WithFindByUsernameResult(MemberMapTestUtils.GenerateValidMemberMap() as IMemberMap);
            _mapper.WithUnmap(null);

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.FindByUsername(validUsername);
        }
Exemplo n.º 11
0
        public async Task FindBySsn_NullMember_ExceptionalCase()
        {
            //arrange
            var validSsn = MemberTestUtils.GenerateValidSsn();

            _access.WithFindBySsnResult(MemberMapTestUtils.GenerateValidMemberMap() as IMemberMap);
            _mapper.WithUnmap(null);

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.FindBySsn(validSsn);
        }
Exemplo n.º 12
0
        public async Task FindBySsn_NullSsn_ExceptionalCase()
        {
            //arrange
            const string nullSsn = null;

            _access.WithFindBySsnResult(MemberMapTestUtils.GenerateValidMemberMap() as IMemberMap);
            _mapper.WithUnmap(MemberTestUtils.GenerateValidMember());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.FindBySsn(nullSsn);
        }
Exemplo n.º 13
0
        public async Task IsMemberInRole_TCI74_InvalidMemberMap()
        {
            //arrange
            var memberMap = MemberMapTestUtils.GenerateValidMemberMap();

            string role = "Member";

            //act
            var result = await _sut.IsMemberInRole(memberMap as MemberMap, role);

            //assert
            Assert.IsNull(result);
        }
Exemplo n.º 14
0
        public async Task IsInRole_InvalidRoleName_ExceptionalCase()
        {
            //arrange
            const string invalidRole = "";
            var          validMember = MemberTestUtils.GenerateValidMember();

            _mapper.WithMap(MemberMapTestUtils.GenerateValidMemberMap());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.IsInRole(validMember, invalidRole);
        }
Exemplo n.º 15
0
        public async Task FindBySsnAndPassword_InvalidPassword_ExceptionalCase()
        {
            //arrange
            var validSsn        = MemberTestUtils.GenerateValidSsn();
            var invalidPassword = MemberTestUtils.GenerateInvalidMember().Password;

            _access.WithFindBySsnAndPasswordResult(MemberMapTestUtils.GenerateValidMemberMap() as IMemberMap);
            _mapper.WithUnmap(MemberTestUtils.GenerateValidMember());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.FindBySsnAndPassword(validSsn, invalidPassword);
        }
Exemplo n.º 16
0
        public async Task IsInRole_ValidMemberAndRole_HappyPath()
        {
            //arrange
            const string validRole   = "validRole";
            var          validMember = MemberTestUtils.GenerateValidMember();

            _mapper.WithMap(MemberMapTestUtils.GenerateValidMemberMap());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.IsInRole(validMember, validRole);

            //assert
            _access.Verify(m => m.IsMemberInRole(It.IsAny <MemberMap>(), It.IsAny <string>()), Times.Once);
        }
Exemplo n.º 17
0
        public async Task FindByUsername_ValidUsername_HappyPath()
        {
            //arrange
            const string validUsername = "******";

            _access.WithFindByUsernameResult(MemberMapTestUtils.GenerateValidMemberMap() as IMemberMap);
            _mapper.WithUnmap(MemberTestUtils.GenerateValidMember());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.FindByUsername(validUsername);

            //assert
            _access.Verify(m => m.FindByUsername(It.IsAny <string>()), Times.Once);
        }
Exemplo n.º 18
0
        public async Task FindBySsn_ValidSsn_HappyPath()
        {
            //arrange
            var validSsn = MemberTestUtils.GenerateValidSsn();

            _access.WithFindBySsnResult(MemberMapTestUtils.GenerateValidMemberMap() as IMemberMap);
            _mapper.WithUnmap(MemberTestUtils.GenerateValidMember());

            _sut = new MemberRepository(_access.Object, _mapper.Object);

            //act
            await _sut.FindBySsn(validSsn);

            //assert
            _access.Verify(m => m.FindBySsn(It.IsAny <string>()), Times.Once);
        }