コード例 #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
ファイル: PostSkillBLL.cs プロジェクト: mickos1972/CVService
 private Skills mapToDal(SkillDomainModel source)
 {
     return(new Skills
     {
         SkillId = source.SkillId,
         Description = source.Description
     });
 }
コード例 #4
0
ファイル: PostSkillBLL.cs プロジェクト: mickos1972/CVService
        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
     });
 }