Exemplo n.º 1
0
        public void Associate_can_set_properties()
        {
            // AAA - Arrange, Act, Assert
            // Arrange
            IAssociate sut = new Associate(() => new Role(),
                                           () => new RolePickList(() => new RoleCollection(),
                                                                  () => new Role()),
                                           () => new Skill(),
                                           () => new SkillPickList(() => new SkillCollection(),
                                                                   () => new Skill()));


            var currentRole = new Role()
            {
                RoleID = 101, Name = "DEV"
            };
            var newRoleCapability = new Role()
            {
                RoleID = 102, Name = "SQA"
            };
            var newSkill = new Skill {
                SkillID = 101, Name = "PW7"
            };

            // Act
            sut.AssociateID = 101;
            sut.Name        = "Tom Wells";
            sut.SetCurrentRole(currentRole.RoleID, currentRole.Name);
            sut.AddRoleCapability(newRoleCapability);
            sut.AddSkill(newSkill);

            // Assert
            Assert.Multiple(() =>
            {
                Assert.That(sut, Is.Not.Null);
                Assert.That(sut.AssociateID, Is.EqualTo(101));
                Assert.That(sut.Name, Is.EqualTo("Tom Wells"));
                Assert.That(sut.CurrentRole.RoleID, Is.EqualTo(101));
                Assert.That(sut.CurrentRole.Name, Is.EqualTo("DEV"));
                Assert.That(sut.RoleCapabilities.Roles.Count, Is.EqualTo(1));
                Assert.That(sut.RoleCapabilities.Roles[0].RoleID, Is.EqualTo(102));
                Assert.That(sut.RoleCapabilities.Roles[0].Name, Is.EqualTo("SQA"));
                Assert.That(sut.SkillList.Skills.Count, Is.EqualTo(1));
                Assert.That(sut.SkillList.Skills[0].SkillID, Is.EqualTo(101));
                Assert.That(sut.SkillList.Skills[0].Name, Is.EqualTo("PW7"));
            });
        }