public IngDataEntryController() { _factory = new DataEntryFactory(); _InventoryFactory = new InventoryFactory(); _BusinessDayFactory = new BusinessDayFactory(); ViewBag.ListStore = GetListStore(); //========== lstStore = ViewBag.ListStore; listStoreId = lstStore.Select(x => x.Value).ToList(); }
private void ShouldGetLinkEntry() { var dataFlowConfiguration = Options.Create( new DataFlowConfiguration { DataSizeLimitInMbs = 0, DataLinkTtlInMinutes = 5 }); var hipConfiguration = Options.Create( new HipConfiguration { Url = "https://hip" }); var serviceScopeFactory = new Mock <IServiceScopeFactory>(); var serviceScope = new Mock <IServiceScope>(); var serviceProvider = new Mock <IServiceProvider>(); var healthInformationRepository = new Mock <IHealthInformationRepository>(); var dataEntryFactory = new DataEntryFactory( serviceScopeFactory.Object, dataFlowConfiguration, hipConfiguration, encryptor.Object); serviceScopeFactory.Setup(x => x.CreateScope()).Returns(serviceScope.Object); serviceScope.Setup(x => x.ServiceProvider).Returns(serviceProvider.Object); serviceProvider.Setup(x => x.GetService(typeof(IHealthInformationRepository))) .Returns(healthInformationRepository.Object); var keyMaterialLib = TestBuilder.KeyMaterialLib(); var transactionId = TestBuilder.Faker().Random.Uuid().ToString(); encryptor.Setup(e => e.EncryptData(keyMaterialLib, It.IsAny <AsymmetricCipherKeyPair>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Option.Some("https://hip/health-information")); var careBundles = new List <CareBundle>(); careBundles.Add(new CareBundle("careContextReference", new Bundle())); var dataEntries = new Entries(careBundles); var entries = dataEntryFactory.Process( dataEntries, keyMaterialLib, transactionId); entries.HasValue.Should().BeTrue(); entries.MatchSome(dataEntries => { foreach (var entry in dataEntries.Entries) { entry.Content.Should().BeNull(); entry.Link.Should().Contain("https://hip/health-information"); } }); }
private void ShouldGetComponentEntry() { var dataFlowConfiguration = Options.Create( new DataFlowConfiguration { DataSizeLimitInMbs = 5, DataLinkTtlInMinutes = 5 }); var hipConfiguration = Options.Create( new HipConfiguration { Url = "https://hip/" }); var serviceScopeFactory = new Mock <IServiceScopeFactory>(MockBehavior.Strict); var dataEntryFactory = new DataEntryFactory( serviceScopeFactory.Object, dataFlowConfiguration, hipConfiguration, encryptor.Object); var bundleList = new List <Bundle>(); bundleList.Add(new Bundle()); var careBundles = new List <CareBundle>(); careBundles.Add(new CareBundle("careContextReference", new Bundle())); var dataEntries = new Entries(careBundles); var expectedEntries = new List <Entry> { new Entry( "5zGyp5O9GkggioxwWyUGOQ==", "application/fhir+json", "MD5", null, "careContextReference") }.AsEnumerable(); var transactionId = TestBuilder.Faker().Random.Uuid().ToString(); var keyMaterial = TestBuilder.KeyMaterialLib(); encryptor.Setup(e => e.EncryptData(keyMaterial, It.IsAny <AsymmetricCipherKeyPair>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Option.Some("5zGyp5O9GkggioxwWyUGOQ==")); var entries = dataEntryFactory.Process(dataEntries, keyMaterial, transactionId); entries.HasValue.Should().BeTrue(); entries.Map(e => e.Entries.Should().BeEquivalentTo(expectedEntries)); }
public BusinessDayFactory() { _baseFactory = new BaseFactory(); _dataEntryFactory = new DataEntryFactory(); }