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 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 GetAssociatedEntries_MatchesAnEntry_CorrectEntryRetrieved() { GeneratorMappingManager genMgr = Factory_GeneratorMappingManager_Default(); Mock <IGeneratorMappingEntry> genEntryMock1 = MockFactory_IGeneratorMappingEntry(); Mock <IGeneratorMappingEntry> genEntryMock2 = MockFactory_IGeneratorMappingEntry(); Mock <IGeneratorMappingEntry> genEntryMock3 = MockFactory_IGeneratorMappingEntry(); genMgr.AddMappingEntry(genEntryMock1.Object); genMgr.AddMappingEntry(genEntryMock2.Object); genMgr.AddMappingEntry(genEntryMock3.Object); MssMsg inputMsg = Factory_MssMsg_CustomTypeAndData1( MssMsgType.RelTimePeriodPos, genEntryMock2.Object.Id); IEnumerable <IMappingEntry> retrievedEntries = genMgr.GetCopiesOfMappingEntriesForMsg(inputMsg); Assert.AreEqual(1, retrievedEntries.Count()); Assert.AreEqual(genEntryMock2.Object.Id, retrievedEntries.First().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); }