예제 #1
0
        public void UpdateImageProfileUrl_InvalidFileSize_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            service.UpdateImageProfileUrl(It.IsAny <string>(), ".jpeg", 1024 * 1024 * 3, It.IsAny <string>());
        }
예제 #2
0
        public void GetProgrammersBySkill_InvalidKnowledgeLevel_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            service.GetProgrammersBySkill(null, 120);
        }
예제 #3
0
        public void UpdateProfileById_InvalidProfileObject_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            service.Update(It.IsAny <string>(), null);
        }
예제 #4
0
        public void GetProgrammersBySkill_InvalidSkillId_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            uow.Setup(a => a.Skills.Get(It.IsAny <int>())).Returns((Skill)null);
            service.GetProgrammersBySkill(It.IsAny <int>(), 100);
        }
예제 #5
0
        public void GetProfileById_ProfileExist_ShouldBeRecieved()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            uow.Setup(a => a.ProgrammerProfiles.Get(It.IsAny <string>())).Returns(new ProgrammerProfile());
            service.Get(It.IsAny <string>());
        }
예제 #6
0
        public void GetProfileById_InvalidProfileId_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            uow.Setup(a => a.ProgrammerProfiles.Get(It.IsAny <string>())).Returns((ProgrammerProfile)null);
            service.Get(It.IsAny <string>());
        }
예제 #7
0
        public void GenerateReport_ProfileListNull_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       mock    = new Mock <IUnitOfWork>();
            IUnitOfWork              uow     = mock.Object;
            ProgrammerProfileService service = new ProgrammerProfileService(uow);

            service.GenerateReport(null);
        }
예제 #8
0
        public void UpdateProfileById_ProfileExist_ShouldBeEditingSaved()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            uow.Setup(a => a.ProgrammerProfiles.Get(It.IsAny <string>())).Returns(new ProgrammerProfile());
            service.Update(It.IsAny <string>(), new ProgrammerProfileDTO());
            uow.Verify(x => x.Save());
        }
예제 #9
0
        public void UpdateProfileById_InvalidProfileId_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork>       uow     = new Mock <IUnitOfWork>();
            ProgrammerProfileService service = new ProgrammerProfileService(uow.Object);

            service.Update("1", new ProgrammerProfileDTO()
            {
                Id = "2"
            });
        }
예제 #10
0
        public void UpdateImageProfileUrl_UpdateImageProfileUrlWithCorrectData_ShouldBeUpdated()
        {
            Mock <IUnitOfWork>       mock    = new Mock <IUnitOfWork>();
            IUnitOfWork              uow     = mock.Object;
            ProgrammerProfileService service = new ProgrammerProfileService(uow);

            mock.Setup(a => a.ProgrammerProfiles.Get(It.IsAny <string>())).Returns(new ProgrammerProfile());
            service.UpdateImageProfileUrl("/assets/image-profiles/", ".jpeg", 1024 * 1024 * 2, It.IsAny <string>());
            mock.Verify(x => x.Save());
        }
예제 #11
0
        public void GetProgrammersBySkill_GetProgrammersBySkillIdNullAndKnowledgeLevel50_ShouldBeRecieved()
        {
            Mock <IUnitOfWork>       mock    = new Mock <IUnitOfWork>();
            IUnitOfWork              uow     = mock.Object;
            ProgrammerProfileService service = new ProgrammerProfileService(uow);

            IEnumerable <ProgrammerSkill> programmerSkills = new List <ProgrammerSkill>
            {
                new ProgrammerSkill()
                {
                    ProgrammerId = "1", SkillId = 1, KnowledgeLevel = 20
                },
                new ProgrammerSkill()
                {
                    ProgrammerId = "2", SkillId = 2, KnowledgeLevel = 60
                },
                new ProgrammerSkill()
                {
                    ProgrammerId = "3", SkillId = 1, KnowledgeLevel = 70
                }
            };
            IEnumerable <ProgrammerProfile> profiles = new List <ProgrammerProfile>
            {
                new ProgrammerProfile()
                {
                    Id = "1"
                },
                new ProgrammerProfile()
                {
                    Id = "2"
                },
                new ProgrammerProfile()
                {
                    Id = "3"
                }
            };
            var expected = new List <ProgrammerProfileDTO>
            {
                new ProgrammerProfileDTO()
                {
                    Id = "2"
                },
                new ProgrammerProfileDTO()
                {
                    Id = "3"
                }
            };

            mock.Setup(a => a.ProgrammerProfiles.GetAll()).Returns(profiles);
            mock.Setup(a => a.ProgrammerSkills.GetAll()).Returns(programmerSkills);
            var actual = service.GetProgrammersBySkill(null, 50);

            CollectionAssert.AreEquivalent(actual.Select(x => x.Id).ToList(), expected.Select(x => x.Id).ToList());
        }