public void GivenCondensedWorkStateWithNoInstalledWhenCreateMetersThenNoMetersCreated() { var spatialRow = new ISOSpatialRow(); const long value = 0xFFFFFFFF; var spatialValue = new SpatialValue { Dlv = new DLV { A = "A1" }, Value = value }; spatialRow.SpatialValues = new List<SpatialValue> { spatialValue }; _isoSpatialRows = new List<ISOSpatialRow> { spatialRow }; var result = new CondensedWorkStateMeterCreator(161, 161).CreateMeters(_isoSpatialRows); Assert.AreEqual(0, result.Count); }
public void GivenDdi162WhenCreateMetersThenSectionsStartWith17() { var result = new CondensedWorkStateMeterCreator(162, 161).CreateMeters(_isoSpatialRows); CheckConsolidatedWorkStateSectionIds(result, 17); }
public void GivenCondensedWorkStateWithSomeStatesNotInstalledThenOnlyCreatesInstalledSections() { var spatialRow = new ISOSpatialRow(); const long notInstalled = 3; long value = 0; for (int i = 15; i > 11; --i) { value |= (notInstalled << i * 2); } var spatialValue = new SpatialValue { Dlv = new DLV { A = "A1" // need to set A specified true? }, Value = value }; spatialRow.SpatialValues = new List<SpatialValue> { spatialValue }; _isoSpatialRows = new List<ISOSpatialRow> { spatialRow }; var result = new CondensedWorkStateMeterCreator(161, 161).CreateMeters(_isoSpatialRows); Assert.AreEqual(12, result.Count); }
public void GivenMetersWithStartAt176WhenGetMetersValueThenValuesCorrect() { SpatialRecord spatialRecord; var meters = CreateMeters(out spatialRecord, 241); var creator = new CondensedWorkStateMeterCreator(176, 161); var result = creator.GetMetersValue(meters, spatialRecord); Assert.AreEqual(0x44444444, result); }
public void GivenCondensedWorkStateDdiWhenCreateMetersThenRepresentationIsSectionStatus() { var result = new CondensedWorkStateMeterCreator(161, 161).CreateMeters(_isoSpatialRows); result.ForEach(x => Assert.AreEqual(x.Representation.Code, RepresentationInstanceList.dtRecordingStatus.DomainId)); }
public void GivenMetersWithStartAt161AndUndefinedWhenGetMetersValueThenValuesCorrect() { var meters = new List<WorkingData>(); for (int i = 1; i < 17; i++) { meters.Add(new ISOEnumeratedMeter { DeviceElementUseId = i }); } var spatialRecord = new SpatialRecord(); for (var i = 0; i < 16; i++) { if (i % 2 == 0) spatialRecord.SetMeterValue(meters[i], new EnumeratedValue { Value = DefinedTypeEnumerationInstanceList.dtiSunny.ToModelEnumMember() }); else spatialRecord.SetMeterValue(meters[i], new EnumeratedValue { Value = DefinedTypeEnumerationInstanceList.dtiRecordingStatusOn.ToModelEnumMember() }); } var creator = new CondensedWorkStateMeterCreator(161, 161); var result = creator.GetMetersValue(meters, spatialRecord); Assert.AreEqual(0x77777777, result); }
public void GivenDdiAndSpatialValueWithNotInstalledStateWhenGetValueForMeterThenSectionValueOffIsReturned() { var spatialValue = new SpatialValue { Dlv = new DLV { A = "A1" }, Value = 3 }; var meter = new EnumeratedWorkingData { DeviceElementUseId = 1 }; var result = new CondensedWorkStateMeterCreator(161, 161).GetValueForMeter(spatialValue, meter); Assert.AreEqual(DefinedTypeEnumerationInstanceList.dtiRecordingStatusOff.ToModelEnumMember().Value, result.Value.Value); }
public void GivenCondensedWorkStateDdiWhenCreateMetersThenMetersSectionsAreSet() { var result = new CondensedWorkStateMeterCreator(161, 161).CreateMeters(_isoSpatialRows); CheckConsolidatedWorkStateSectionIds(result, 1); }
public void GivenDdi305WhenCreateMetersThenSectionsStartWith241() { var result = new CondensedWorkStateMeterCreator(305, 290).CreateMeters(_isoSpatialRows); CheckConsolidatedWorkStateSectionIds(result, 241); }
public void GivenDdi299WhenCreateMetersThenSectionsStartWith145() { var result = new CondensedWorkStateMeterCreator(299, 290).CreateMeters(_isoSpatialRows); CheckConsolidatedWorkStateSectionIds(result, 145); }
public void GivenCondensedWorkStateDdiWhenCreateMetersThenMeters() { var result = new CondensedWorkStateMeterCreator(161, 161).CreateMeters(_isoSpatialRows); Assert.AreEqual(16, result.Count); }