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"); }
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); }
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); }
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); }
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)); }
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); }
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); }