public void AssociateCollection_can_add_skill() { // AAA - Arrange, Act, Assert // Arrange var sut = new AssociateCollection(); IAssociate a1 = new Associate(() => new Role(), () => new RolePickList(() => new RoleCollection(), () => new Role()), () => new Skill(), () => new SkillPickList(() => new SkillCollection(), () => new Skill()) ) { AssociateID = 101, Name = "Aaron Schatzer", Tenure = 10, CurrentRoleID = 100 }; // Act sut.Add(a1); // Assert Assert.Multiple(() => { Assert.That(sut.Count, Is.EqualTo(1)); Assert.That(sut[0].AssociateID, Is.EqualTo(101)); Assert.That(sut[0].Name, Is.EqualTo("Aaron Schatzer")); }); }
public int AddAssociate(string name, float tenure, int currentRoleID) { int result = -1; var newAssociate = CreateNewAssociate(); newAssociate.Name = name; newAssociate.Tenure = tenure; newAssociate.CurrentRoleID = currentRoleID; newAssociate.AssociateID = _allAssociates.Max(a => a.AssociateID + 1); _allAssociates.Add(newAssociate); result = newAssociate.AssociateID; return(result); }