public void RemoveGenMappingEntry_RemoveSecondEntry_SuccessfullyRemoved() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); Mock <IGeneratorMappingEntry> genEntryMock1 = MockFactory_IGeneratorMappingEntry(); Mock <IGeneratorMappingEntry> genEntryMock2 = MockFactory_IGeneratorMappingEntry(); Mock <IGeneratorMappingEntry> genEntryMock3 = MockFactory_IGeneratorMappingEntry(); int id1 = genMgr.AddMappingEntry(genEntryMock1.Object); int id2 = genMgr.AddMappingEntry(genEntryMock2.Object); int id3 = genMgr.AddMappingEntry(genEntryMock3.Object); genMgr.RemoveMappingEntry(id2); Assert.AreEqual(2, genMgr.GetNumEntries()); Assert.AreEqual(genEntryMock1.Object.Id, genMgr.GetCopyOfMappingEntryById(id1).Value.Id); Assert.AreEqual(genEntryMock3.Object.Id, genMgr.GetCopyOfMappingEntryById(id3).Value.Id); }
public void AddGenMappingEntry_SingleEntry_SuccessfullyAdded() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); Mock <IGeneratorMappingEntry> genEntryMock = MockFactory_IGeneratorMappingEntry(); int newId = genMgr.AddMappingEntry(genEntryMock.Object); Assert.AreEqual(1, genMgr.GetNumEntries()); Assert.AreEqual(genEntryMock.Object.Id, genMgr.GetCopyOfMappingEntryById(newId).Value.Id); Assert_GenEntryIsInitialized(genEntryMock.Object); }
public void CreateAndAddEntryFromGenInfo_TimeBasedGenInfo_CorrectlyInitializedInRangeType() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); GenEntryConfigInfo genConfigInfo = Factory_GenEntryConfigInfo_Default(); genConfigInfo.PeriodType = GenPeriodType.Time; int newId = genMgr.CreateAndAddEntryFromGenInfo(genConfigInfo); IReturnStatus <IGeneratorMappingEntry> getCopyRetStatus = genMgr.GetCopyOfMappingEntryById(newId); Assert.IsTrue(getCopyRetStatus.IsValid); Assert.AreEqual(MssMsgType.RelTimePeriodPos, getCopyRetStatus.Value.InMssMsgRange.MsgType); }
public void CreateAndAddEntryFromGenInfo_DefaultGenInfo_CorrectlyInitializedInfoClassses() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); GenEntryConfigInfo genConfigInfo = Factory_GenEntryConfigInfo_Default(); int newId = genMgr.CreateAndAddEntryFromGenInfo(genConfigInfo); IGeneratorMappingEntry genEntry = genMgr.GetCopyOfMappingEntryById(newId).Value; //GenHistoryInfo should not be initialized until the first MSS Event is generated Assert.IsFalse(genEntry.GenHistoryInfo.Initialized); Assert_GenEntryIsInitialized(genEntry); Assert.IsNotNull(genEntry.CurveShapeInfo); }
public void GetGenMappingEntryById_RetrieveSecondEntry_SuccessfullyRetrieved() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); Mock <IGeneratorMappingEntry> genEntryMock1 = MockFactory_IGeneratorMappingEntry(); Mock <IGeneratorMappingEntry> genEntryMock2 = MockFactory_IGeneratorMappingEntry(); Mock <IGeneratorMappingEntry> genEntryMock3 = MockFactory_IGeneratorMappingEntry(); int id1 = genMgr.AddMappingEntry(genEntryMock1.Object); int id2 = genMgr.AddMappingEntry(genEntryMock2.Object); int id3 = genMgr.AddMappingEntry(genEntryMock3.Object); IGeneratorMappingEntry retrievedEntry = genMgr.GetCopyOfMappingEntryById(genEntryMock2.Object.Id).Value; Assert.AreEqual(genEntryMock2.Object.Id, retrievedEntry.Id); }
public void CreateAndAddEntryFromGenInfo_DefaultGenInfo_CorrectlyInitializedOutRange() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); GenEntryConfigInfo genConfigInfo = Factory_GenEntryConfigInfo_Default(); int newId = genMgr.CreateAndAddEntryFromGenInfo(genConfigInfo); IReturnStatus <IGeneratorMappingEntry> getCopyRetStatus = genMgr.GetCopyOfMappingEntryById(newId); Assert.IsTrue(getCopyRetStatus.IsValid); IGeneratorMappingEntry genEntry = getCopyRetStatus.Value; Assert.AreEqual(genEntry.Id, genEntry.OutMssMsgRange.Data1RangeBottom); Assert.AreEqual(genEntry.Id, genEntry.OutMssMsgRange.Data1RangeTop); Assert.AreEqual(MssMsgUtil.UNUSED_MSS_MSG_DATA, genEntry.OutMssMsgRange.Data2RangeBottom); Assert.AreEqual(MssMsgUtil.UNUSED_MSS_MSG_DATA, genEntry.OutMssMsgRange.Data2RangeTop); Assert.AreEqual(MssMsgType.Generator, genEntry.OutMssMsgRange.MsgType); }