private void AddDevToTeam() { SeeAllDev(); Console.WriteLine("\nEnter ID of developer you would like to add to Team:"); string identAsInt = Console.ReadLine(); int devID = Convert.ToInt32(identAsInt); DevContent pulledID = _contentRepo.GetDevContentByID(devID); GetDevTeamList(); Console.WriteLine("\nWhat is the ID of the team you would like to add to:"); string teamIdentAsInt = Console.ReadLine(); int devTeamID = Convert.ToInt32(teamIdentAsInt); DevTeamContent pulledTeamID = _teamRepo.GetDevTeamByID(devTeamID); //add pulledID to pulledTeamID?????? pulledTeamID.ListOfDevs.Add(pulledID); //COME BACK LATER //bool wasAdded = _teamRepo.RemoveFromTeam(); //if (wasAdded) //{ // Console.WriteLine("Developer successfully added to Team."); //} //else //{ // Console.WriteLine("Error... Developer could not be added."); //} }
public void DefaultValues() { _repo = new DevRepo(); _content = new DevContent("Brittany Beahan", 2, true); _repo.AddDevToList(_content); }
public void UpdateDevContent_ShouldReturnTrue(int originalID, bool shouldUpdate) { DevContent newContent = new DevContent("Richard Torres", 1, false); bool updateResult = _repo.UpdateDevContent(originalID, newContent); Assert.AreEqual(shouldUpdate, updateResult); }
public void SetID_ShouldSetCorrectInt() { DevContent content = new DevContent("Richard Torres", 1, true); int expected = 1; int actual = content.IdentificationNumber; Assert.AreEqual(expected, actual); }
public void AddDevToList_ShouldGetNotNull() { DevContent content = new DevContent("Richard Torres", 1, true); DevRepo repository = new DevRepo(); repository.AddDevToList(content); DevContent contentfromDirectory = repository.GetDevContentByID(1); Assert.IsNotNull(contentfromDirectory); }
//Update Dev private void UpdateDev() { SeeAllDev(); Console.WriteLine("\nEnter ID number of Developer you would like to update:"); string value = Console.ReadLine(); int oldDev = Convert.ToInt32(value); DevContent newDev = new DevContent(); Console.WriteLine("What is the First and Last name of the developer:"); newDev.FullName = Console.ReadLine(); Console.WriteLine("What is the developers Identification Number:"); string identAsInt = Console.ReadLine(); newDev.IdentificationNumber = int.Parse(identAsInt); Console.WriteLine("Does this developer have Pluralsight access: (yes/no)"); string yesNo = Console.ReadLine().Trim().ToLower(); if (yesNo == "yes") { newDev.AccessPlural = true; } else if (yesNo == "no") { newDev.AccessPlural = false; } else { Console.WriteLine("Incorrect value entered, Pluralsight defaulted to NO. If this is incorrect then please update developer data."); newDev.AccessPlural = false; } bool wasUpdated = _contentRepo.UpdateDevContent(oldDev, newDev); if (wasUpdated) { Console.WriteLine("Developer successfuly updated."); } else { Console.WriteLine("Error... Could not update Developer."); } }
//Add new DevContent private void AddNewDev() { bool addAnotherDev = true; while (addAnotherDev == true) { Console.Clear(); DevContent newDev = new DevContent(); Console.WriteLine("What is the First and Last name of the developer:"); newDev.FullName = Console.ReadLine(); Console.WriteLine("What is the developers Identification Number:"); string identAsInt = Console.ReadLine(); newDev.IdentificationNumber = int.Parse(identAsInt); Console.WriteLine("Does this developer have Pluralsight access: (yes/no)"); string yesNo = Console.ReadLine().Trim().ToLower(); if (yesNo == "yes") { newDev.AccessPlural = true; } else if (yesNo == "no") { newDev.AccessPlural = false; } else { Console.WriteLine("Incorrect value entered, Pluralsight defaulted to NO. If this is incorrect then please update developer data."); newDev.AccessPlural = false; } _contentRepo.AddDevToList(newDev); Console.WriteLine("\nWould you like to add another user? (yes/no)"); string addMoreDev = Console.ReadLine().Trim().ToLower(); if (addMoreDev == "yes") { addAnotherDev = true; } else { addAnotherDev = false; } } }
private void RemoveDevFromTeam() { SeeAllDev(); Console.WriteLine("\nEnter ID of developer you would like to add to Team:"); string identAsInt = Console.ReadLine(); int devID = Convert.ToInt32(identAsInt); DevContent pulledID = _contentRepo.GetDevContentByID(devID); GetDevTeamList(); Console.WriteLine("\nWhat is the ID of the team you would like to remove from:"); string teamIdentAsInt = Console.ReadLine(); int devTeamID = Convert.ToInt32(teamIdentAsInt); DevTeamContent pulledTeamID = _teamRepo.GetDevTeamByID(devTeamID); pulledTeamID.ListOfDevs.Remove(pulledID); }
//Seed Method private void DefaultDevList() { DevContent devOne = new DevContent("Richard Torres", 1, false); DevContent devTwo = new DevContent("Brittany Beahan", 2, true); DevContent devThree = new DevContent("Andrew Owen", 3, false); DevContent devFour = new DevContent("Aimee Owen", 4, true); DevContent devFive = new DevContent("Lukas Rydberg", 5, false); DevContent devSix = new DevContent("Corrie Rydberg", 6, true); _contentRepo.AddDevToList(devOne); _contentRepo.AddDevToList(devTwo); _contentRepo.AddDevToList(devThree); _contentRepo.AddDevToList(devFour); _contentRepo.AddDevToList(devFive); _contentRepo.AddDevToList(devSix); List <DevContent> listOfTeamOne = new List <DevContent>(); listOfTeamOne.Add(devOne); listOfTeamOne.Add(devTwo); List <DevContent> listOfTeamTwo = new List <DevContent>(); listOfTeamTwo.Add(devThree); listOfTeamTwo.Add(devFour); List <DevContent> listOfTeamThree = new List <DevContent>(); listOfTeamThree.Add(devFive); listOfTeamThree.Add(devSix); DevTeamContent teamOne = new DevTeamContent("Team Alpha", 1, listOfTeamOne); DevTeamContent teamTwo = new DevTeamContent("Team Bravo", 2, listOfTeamTwo); DevTeamContent teamThree = new DevTeamContent("Team Charlie", 3, listOfTeamThree); _teamRepo.AddNewTeam(teamOne); _teamRepo.AddNewTeam(teamTwo); _teamRepo.AddNewTeam(teamThree); }
//Get Dev by ID private void SeeDevByID() { Console.Clear(); //Prompt for ID Console.WriteLine("Enter Developer ID number to view:"); //Find Content by ID string value = Console.ReadLine(); int employeeID = Convert.ToInt32(value); DevContent content = _contentRepo.GetDevContentByID(employeeID); //Display Content Found if it isn't null if (content != null) { Console.WriteLine($"Developer Name: {content.FullName}\n" + $"Developer ID: {content.IdentificationNumber}\n" + $"Pluralsight Access: {content.AccessPlural}"); } else { Console.WriteLine("Developer does not exist, if this is an error add Developer."); } }