protected override Task Context() { _parameterMapper = A.Fake <ParameterMapper>(); _schemaMapper = A.Fake <SchemaMapper>(); _protocolFactory = A.Fake <IProtocolFactory>(); _dimensionRepository = A.Fake <IDimensionRepository>(); sut = new ProtocolMapper(_parameterMapper, _protocolFactory, _schemaMapper, _dimensionRepository); _simpleProtocol = new SimpleProtocol { ApplicationType = ApplicationTypes.Intravenous, DosingInterval = DosingIntervals.DI_6_6_12, Name = "Simple Protocol", Description = "Simple Protocol description", }; _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(3).WithName(Constants.Parameters.START_TIME)); _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(4).WithName(CoreConstants.Parameters.INPUT_DOSE)); _simpleProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(5).WithName(Constants.Parameters.END_TIME)); A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.StartTime)).Returns(new Parameter().WithName(_simpleProtocol.StartTime.Name)); A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.Dose)).Returns(new Parameter().WithName(_simpleProtocol.Dose.Name)); A.CallTo(() => _parameterMapper.MapToSnapshot(_simpleProtocol.EndTimeParameter)).Returns(new Parameter().WithName(_simpleProtocol.EndTimeParameter.Name)); _advancedProtocol = new AdvancedProtocol { Name = "Advanced Protocol", Description = "Advanced Protocol description", TimeUnit = DomainHelperForSpecs.TimeDimensionForSpecs().DefaultUnit, }; _schema = new Schema().WithName("Schema1"); _advancedProtocol.AddSchema(_schema); _advancedProtocolParameter = DomainHelperForSpecs.ConstantParameterWithValue(3).WithName("AdvancedProtocolParameter"); _advancedProtocol.Add(_advancedProtocolParameter); A.CallTo(() => _parameterMapper.MapToSnapshot(_advancedProtocolParameter)).Returns(new Parameter().WithName(_advancedProtocolParameter.Name)); _snapshotSchema = new Snapshots.Schema().WithName(_schema.Name); A.CallTo(() => _schemaMapper.MapToSnapshot(_schema)).Returns(_snapshotSchema); A.CallTo(() => _dimensionRepository.Time).Returns(DomainHelperForSpecs.TimeDimensionForSpecs()); return(Task.FromResult(true)); }
protected override void Context() { base.Context(); _sourceProtocol = new SimpleProtocol { Id = "Id", Name = "Simple Protocol", Description = "tralala" }; _sourceProtocol.Add(DomainHelperForSpecs.ConstantParameterWithValue(1).WithName("SimpleParameter")); _targetProtocol = new AdvancedProtocol { DomainHelperForSpecs.ConstantParameterWithValue(1).WithName(name: "AdvancedParameter") }; _schema1 = new Schema { Name = "Schema1" }; _schema2 = new Schema { Name = "Schema2" }; _oldSchema = new Schema { Name = "_oldSchema" }; _targetProtocol.AddSchema(_oldSchema); A.CallTo(() => _schemaMapper.MapFrom(_sourceProtocol)).Returns(new[] { _schema1, _schema2 }); }