public void Setup() { this.npgsqlTransaction = null; this.securityContext = new Mock <ISecurityContext>(); //// edA //// / \ //// euA euB //// / \ //// edB edC //// / \ //// euC euD euE will be added. euE-edD does not throw an exception, but euD-edA does throw //// / \ \ //// edD edA edD this.edD = new ElementDefinition { Iid = Guid.NewGuid() }; this.euE = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edD.Iid }; this.euC = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edD.Iid }; this.edC = new ElementDefinition { Iid = Guid.NewGuid(), ContainedElement = new List <Guid> { this.euC.Iid } }; this.euB = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edC.Iid }; this.edB = new ElementDefinition { Iid = Guid.NewGuid() }; this.euA = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edB.Iid }; this.edA = new ElementDefinition { Iid = Guid.NewGuid(), ContainedElement = new List <Guid> { this.euA.Iid, this.euB.Iid } }; this.euD = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edA.Iid }; this.elementDefinitionService = new Mock <IElementDefinitionService>(); this.elementDefinitionService .Setup(x => x.Get(this.npgsqlTransaction, It.IsAny <string>(), null, It.IsAny <ISecurityContext>())) .Returns(new List <Thing> { this.edA, this.edB, this.edC, this.edD }); this.elementUsageService = new Mock <IElementUsageService>(); this.elementUsageService .Setup(x => x.Get(this.npgsqlTransaction, It.IsAny <string>(), null, It.IsAny <ISecurityContext>())) .Returns(new List <Thing> { this.euA, this.euB, this.euC, this.euD, this.euE }); this.iteration = new Iteration { Iid = Guid.NewGuid(), Element = new List <Guid> { this.edA.Iid, this.edB.Iid, this.edC.Iid, this.edD.Iid } }; this.sideEffect = new ElementDefinitionSideEffect() { ElementDefinitionService = this.elementDefinitionService.Object, ElementUsageService = this.elementUsageService.Object }; }
public void Setup() { this.npgsqlTransaction = null; this.securityContext = new Mock <ISecurityContext>(); this.iterationService = new Mock <IIterationService>(); this.iterationSetupService = new Mock <IIterationSetupService>(); this.engineeringModelSetupService = new Mock <IEngineeringModelSetupService>(); this.engineeringModelService = new Mock <IEngineeringModelService>(); this.requestUtils = new Mock <IRequestUtils>(); //// edA //// / \ //// euA euB //// / \ //// edB edC //// / \ //// euC euD euE will be added. euE-edD does not throw an exception, but euD-edA does throw //// / \ \ //// edD edA edD this.edD = new ElementDefinition { Iid = Guid.NewGuid() }; this.euE = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edD.Iid }; this.euC = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edD.Iid }; this.edC = new ElementDefinition { Iid = Guid.NewGuid(), ContainedElement = new List <Guid> { this.euC.Iid } }; this.euB = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edC.Iid }; this.edB = new ElementDefinition { Iid = Guid.NewGuid() }; this.euA = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edB.Iid }; this.edA = new ElementDefinition { Iid = Guid.NewGuid(), ContainedElement = new List <Guid> { this.euA.Iid, this.euB.Iid } }; this.euD = new ElementUsage { Iid = Guid.NewGuid(), ElementDefinition = this.edA.Iid }; this.elementDefinitionService = new Mock <IElementDefinitionService>(); this.elementDefinitionService .Setup(x => x.Get(this.npgsqlTransaction, It.IsAny <string>(), null, It.IsAny <ISecurityContext>())) .Returns(new List <Thing> { this.edA, this.edB, this.edC, this.edD }); this.elementUsageService = new Mock <IElementUsageService>(); this.elementUsageService .Setup(x => x.Get(this.npgsqlTransaction, It.IsAny <string>(), null, It.IsAny <ISecurityContext>())) .Returns(new List <Thing> { this.euA, this.euB, this.euC, this.euD, this.euE }); this.iterationSetup = new IterationSetup { Iid = Guid.NewGuid() }; this.iteration = new Iteration { Iid = Guid.NewGuid(), Element = new List <Guid> { this.edA.Iid, this.edB.Iid, this.edC.Iid, this.edD.Iid }, TopElement = this.edA.Iid, IterationSetup = this.iterationSetup.Iid }; this.updatedIteration = this.iteration.DeepClone <Iteration>(); this.iterationSetup.IterationIid = this.iteration.Iid; this.engineeringModelSetup = new EngineeringModelSetup { Iid = Guid.NewGuid(), IterationSetup = new List <Guid> { this.iterationSetup.Iid } }; this.engineeringModel = new EngineeringModel { Iid = Guid.NewGuid(), EngineeringModelSetup = this.engineeringModelSetup.Iid }; this.engineeringModelSetup.EngineeringModelIid = this.engineeringModel.Iid; this.sideEffect = new ElementDefinitionSideEffect { ElementDefinitionService = this.elementDefinitionService.Object, ElementUsageService = this.elementUsageService.Object, IterationService = this.iterationService.Object, IterationSetupService = this.iterationSetupService.Object, EngineeringModelSetupService = this.engineeringModelSetupService.Object, EngineeringModelService = this.engineeringModelService.Object, RequestUtils = this.requestUtils.Object }; }