Esempio n. 1
0
        public async Task BuildAsync_GivenAccountExecutive_SetsUserTypeDescriptionToAccountExecutive()
        {
            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(456)).Returns(Task.FromResult((User)SampleData.AccountExecutive()));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 456, loggedInUserId : 0);

            Assert.AreEqual(viewModel.UserTypeDescription, "Account Executive");
        }
Esempio n. 2
0
        public async Task BuildAsync_GivenTheIdOfAUserThatDoesntExist_ReturnsNull()
        {
            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(123)).Returns(Task.FromResult(null as User));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 123, loggedInUserId : 0);

            Assert.IsNull(viewModel);
        }
Esempio n. 3
0
        public async Task BuildAsync_GivenUserViewingOthersProfile_SetsProfileBelongsToCurrentUserFalse()
        {
            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(123)).Returns(Task.FromResult((User)SampleData.Consultant()));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 123, loggedInUserId : 456);

            Assert.IsFalse(viewModel.ProfileBelongsToCurrentUser);
        }
Esempio n. 4
0
        public async Task BuildAsync_GivenConsultantWithoutResume_LeavesResumeNull()
        {
            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(123)).Returns(Task.FromResult((User)SampleData.Consultant()));
            _fakeResumeManager.Setup(x => x.LoadResumeMetadataByUserIdAsync(123)).Returns(Task.FromResult(null as ResumeMetadata));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 123, loggedInUserId : 0);

            Assert.IsNull(viewModel.ResumeMetadata);
        }
Esempio n. 5
0
        public async Task BuildAsync_GivenConsultant_LoadsTagsOrderedByName()
        {
            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(123)).Returns(Task.FromResult((User)SampleData.Consultant()));
            var consultantSkills = SampleData.ConsultantSkillList(123);
            var consultantSkillsOrderedByName = consultantSkills.OrderBy(x => x.SkillName);

            _fakeTagManager.Setup(x => x.LoadSkillsForConsultantAsync(123)).Returns(Task.FromResult(consultantSkills));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 123, loggedInUserId : 0);

            Assert.IsTrue(consultantSkillsOrderedByName.SequenceEqual(viewModel.ConsultantSkills));
        }
Esempio n. 6
0
        public async Task BuildAsync_GivenConsultantWithResume_LoadsResume()
        {
            var consultant = SampleData.Consultant();

            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(123)).Returns(Task.FromResult((User)consultant));
            var resume = SampleData.ResumeMetadata();

            _fakeResumeManager.Setup(x => x.LoadResumeMetadataByUserIdAsync(123)).Returns(Task.FromResult(resume));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 123, loggedInUserId : 0);

            Assert.AreEqual(viewModel.ResumeMetadata, resume);
        }
Esempio n. 7
0
        public async Task BuildAsync_GivenUser_SetsCommonUserInfo()
        {
            _fakeUserManager.Setup(x => x.LoadUserByIdAsync(123)).Returns(Task.FromResult((User)SampleData.Consultant()));
            DetailsViewModelBuilder subject = _fixture.Create <DetailsViewModelBuilder>();

            var viewModel = await subject.BuildAsync(profileUserId : 123, loggedInUserId : 0);

            Assert.AreEqual(viewModel.UserId, 123);
            Assert.AreEqual(viewModel.Email, "*****@*****.**");
            Assert.AreEqual(viewModel.FirstName, "Bill");
            Assert.AreEqual(viewModel.LastName, "Smith");
            Assert.AreEqual(viewModel.FullName, "Bill Smith");
            Assert.AreEqual(viewModel.PhoneNumber, "(123) 456-7890");
            Assert.AreEqual(viewModel.IsOnBeach, true);
        }