예제 #1
0
        public void GetSkills_ShouldReturnListOfDomainSkillObject()
        {
            //Arrange
            var ContactId = 1;

            var skillModelDal = new Skills
            {
                SkillId     = ContactId,
                Description = "Test Description"
            };

            var skillModelDomain = new SkillDomainModel()
            {
                SkillId     = ContactId,
                Description = "returned and mapped object"
            };

            var dalMock = Substitute.For <IGetSkillsDAL>();

            dalMock.GetSkillByContactId(1).ReturnsForAnyArgs(skillModelDal); // ReturnsForAnyArgs(skillModelDal);

            var sut = new GetSkillsBLL(dalMock);

            //Act
            var result = sut.getSkillsByIdBLL(ContactId);

            //Assert
            Assert.Equal(ContactId, result.SkillId);
            Assert.Equal("Test Description", result.Description);
        }
예제 #2
0
        public void PostSkill_ReturnedObjectShouldHaveSameValues()
        {
            //Arrange
            var ContactId = 1;

            var skillModelDal = new Skills
            {
                SkillId     = 1,
                Description = "Test Description"
            };

            var skillModelDomain = new SkillDomainModel()
            {
                SkillId     = ContactId,
                Description = "returned and mapped object"
            };

            var dalMock = Substitute.For <IPostSkillDAL>();

            dalMock.postSkillDAL(ContactId, skillModelDal).ReturnsForAnyArgs(skillModelDal);

            var sut = new PostSkillBLL(dalMock);

            //Act
            var result = sut.postSkillBLL(ContactId, skillModelDomain);

            //Assert
            Assert.Equal(1, result.SkillId);
            Assert.Equal("Test Description", result.Description);
        }
예제 #3
0
 private Skills mapToDal(SkillDomainModel source)
 {
     return(new Skills
     {
         SkillId = source.SkillId,
         Description = source.Description
     });
 }
예제 #4
0
        public SkillDomainModel postSkillBLL(int ContactId, SkillDomainModel skill)
        {
            var result = mapToDal(skill);

            var newSkill = _postSkillDAL.postSkillDAL(ContactId, result);

            return(mapFromDal(newSkill));
        }
예제 #5
0
 private static SkillViewModel MapFromDomain(SkillDomainModel source)
 {
     return(new SkillViewModel
     {
         skillId = source.SkillId,
         description = source.Description
     });
 }