예제 #1
0
            public async Task DownloadResume_GivenUserThatHasNoResume_ReturnsHttpNotFound()
            {
                // account exec with id 456 is trying to download a resume for a consultant that doesn't have one
                var accountExecutive456 = (User)SampleData.AccountExecutive();

                _fakeUserManager.Setup(x => x.LoadUserByIdAsync(456)).Returns(Task.FromResult(accountExecutive456));
                _fakeResumeManager.Setup(x => x.LoadResumeByUserIdAsync(123)).Returns(Task.FromResult((Resume)null));
                SetLoggedInUserId(456);
                var subject = _fixture.Create <ProfileController>();

                var actionResult = await subject.DownloadResume(123);

                AssertX.Is404NotFoundResult(actionResult);
            }
예제 #2
0
            public async Task UpdateBeachStatus_GivenAccountExecutive_DoesntChangeBeachStatus()
            {
                int accountExecutiveId = InsertUser(SampleData.AccountExecutive());

                TestDatabase.Execute("UPDATE Users SET IsOnBeach = 1 WHERE Id = @0", accountExecutiveId);

                using (var subject = _fixture.Create <UserManager>())
                {
                    await subject.UpdateBeachStatusAsync(accountExecutiveId, false);
                }

                var accountExecutivesBeachStatus = TestDatabase.QueryValue("SELECT IsOnBeach FROM Users WHERE Id = @0", accountExecutiveId);

                Assert.AreEqual(true, accountExecutivesBeachStatus);
            }
예제 #3
0
            public async Task DownloadResume_GivenAccountExecutiveISDownloadingResume_ReturnsResume()
            {
                // account exec with id 456 is trying to download the resume for consultant #123
                var accountExecutive456 = (User)SampleData.AccountExecutive();

                _fakeUserManager.Setup(x => x.LoadUserByIdAsync(456)).Returns(Task.FromResult(accountExecutive456));
                var resume = SampleData.Resume(userId: 123);

                _fakeResumeManager.Setup(x => x.LoadResumeByUserIdAsync(123)).Returns(Task.FromResult(resume));
                SetLoggedInUserId(456);
                var subject = _fixture.Create <ProfileController>();

                var actionResult = await subject.DownloadResume(123);

                Assert.IsInstanceOfType(actionResult, typeof(FileContentResult));
            }
예제 #4
0
            public SearchConsultants()
            {
                // Set up sample data for all tests.
                var cSharp          = InsertSkill("C#", true);
                var aspNet          = InsertSkill("ASP.NET", true);
                var jugglingOranges = InsertSkill("Juggling Oranges", false);

                InsertUser(SampleData.AccountExecutive());

                int consultant1Id = InsertUser(SampleData.Consultant(emailAddress: "*****@*****.**", lastName: "Jenkins", isOnBeach: true));

                InsertConsultantSkill(consultant1Id, cSharp.Id);
                InsertConsultantSkill(consultant1Id, aspNet.Id);

                int consultant2Id = InsertUser(SampleData.Consultant(emailAddress: "*****@*****.**", lastName: "Smith", isOnBeach: false));

                InsertConsultantSkill(consultant2Id, jugglingOranges.Id);
            }
예제 #5
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");
        }