Ejemplo n.º 1
0
        public Rig GenerateRig(string rigType, string name, string description)
        {
            RigTemplate rigTemplate = m_rigTemplateRepository.GetRigTemplate(rigType);

            Rig rig = m_rigRepository.Create(rigType, name, description);

            foreach (EquipmentTemplate equipmentTemplate in rigTemplate.EquipmentTemplates)
            {
                Equipment currentEquipment = m_equipmentRepository.Create(rig.Id, null, equipmentTemplate.Name, equipmentTemplate.Type, equipmentTemplate.IsSystem);
                currentEquipment.Fields.AddRange(equipmentTemplate.Fields);

                foreach (EquipmentTemplate subTemplate in equipmentTemplate.SubTemplates)
                {
                    // All sub items must set isSystem to false.
                    Equipment subEquipment = m_equipmentRepository.Create(rig.Id, currentEquipment.Id, subTemplate.Name, subTemplate.Type, isSystem: false);
                    subEquipment.Fields.AddRange(subTemplate.Fields);

                    m_equipmentRepository.Update(subEquipment);
                }

                m_equipmentRepository.Update(currentEquipment);
            }

            return(rig);
        }
Ejemplo n.º 2
0
        public void GenerateRig_GetsRigTemplate_From_TemplateRepo()
        {
            m_testSubject.GenerateRig("Jackup", string.Empty, string.Empty);

            A.CallTo(() => m_rigTemplateRepo.GetRigTemplate("Jackup")).MustHaveHappenedOnceExactly();
        }