private SystemRelation CreateRelation()
        {
            var systemRelation = new SystemRelation(new ItSystemUsage());

            systemRelation.SetRelationTo(new ItSystemUsage {
                Id = A <int>()
            });
            return(systemRelation);
        }
示例#2
0
        private void SetupSystemRelation(int systemRelationId, Mock <ItSystemUsage> sourceSystemUsage, Mock <ItSystemUsage> targetSystemUsage)
        {
            var usageSystemRelation = new SystemRelation(sourceSystemUsage.Object)
            {
                Id                = systemRelationId,
                Description       = "MyDescription",
                Reference         = "https://dummy.dk",
                RelationInterface = new ItInterface {
                    Id = Interface1Id
                },
                AssociatedContract = new ItContract {
                    Id = Contract1Id
                },
                UsageFrequency = new RelationFrequencyType {
                    Id = FrequencyType1Id
                }
            };

            usageSystemRelation.SetRelationTo(targetSystemUsage.Object);
            sourceSystemUsage.SetupGet(u => u.UsageRelations).Returns(new List <SystemRelation> {
                usageSystemRelation
            });
            var itInterfaceExhibits = new List <ItInterfaceExhibit>
            {
                new ItInterfaceExhibit {
                    ItInterface = new ItInterface {
                        Id = Interface1Id
                    }
                },
                new ItInterfaceExhibit {
                    ItInterface = new ItInterface {
                        Id = Interface2Id
                    }
                }
            };
            var mockTargetItSystem = new Mock <ItSystem>();

            mockTargetItSystem.SetupGet(s => s.ItInterfaceExhibits).Returns(itInterfaceExhibits);
            targetSystemUsage.SetupGet(u => u.ItSystem).Returns(mockTargetItSystem.Object);
            _mockSystemRelationRepository.Setup(r => r.GetByKey(usageSystemRelation.Id)).Returns(usageSystemRelation);
        }