public void GetData_ResolveIdentifiers_True() { InMemoryRecord record = DowntimeRecords.NewRecord().MarkAsNew(); record.SetFieldIdValue("Cause", "Shutdown", 100); record.SetFieldIdValue("Classification", "Unplanned Process", 200); database.EnableModule("Downtime"); configuration.EnableModule("Downtime"); configuration.AddLocation("Downtime", "Enterprise.Site.Area.Downtime"); SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient(database, configuration, new SimpleSecurityWebServiceClient("User")); record.SaveTo(webServiceClient); List <InMemoryRecord> records = new List <InMemoryRecord>(database.GetModuleRecords("Downtime").Values); Assert.That(records, Is.Not.Empty); string recordId = Convert.ToString(records[0].RecordId); GetDataRequest request = new GetDataRequest { Credentials = CreateCredentials(), Filter = new DataFilter { Location = record.Location, Criteria = new [] { new FilterEntry { Name = "Id", Value = recordId } } }, View = new GetDataView { Context = NavigationContext.Plant, Mode = NavigationMode.Location, Module = AmplaModules.Downtime }, Metadata = true, OutputOptions = new GetDataOutputOptions { ResolveIdentifiers = true } }; GetDataResponse response = webServiceClient.GetData(request); AssertResponseContainsValue(response, "Cause", "Shutdown"); AssertResponseContainsValue(response, "Classification", "Unplanned Process"); }
public void LoadModelWithStrings() { InMemoryRecord record = EnergyRecords.NewRecord().MarkAsNew(); Assert.That(record.Location, Is.EqualTo(location)); record.SetFieldValue("Cause Location", "Plant.Area"); record.SetFieldIdValue("Cause", "Shutdown", 100); record.SetFieldIdValue("Classification", "Unplanned Process", 200); SaveRecord(record); Assert.That(Records, Is.Not.Empty); int recordId = Records[0].RecordId; Assert.That(recordId, Is.GreaterThan(0)); IdentifierEnergyModel model = Repository.FindById(recordId); Assert.That(model, Is.Not.Null); Assert.That(model.Cause, Is.EqualTo(100)); Assert.That(model.Classification, Is.EqualTo(200)); }