public void SaveEntryList() { // Arrange ResistorCalculatorService.ResistorCalculatorServiceClient service = new ResistorCalculatorService.ResistorCalculatorServiceClient(); // Act // get the original entry list Dictionary <int, ResistorCalculatorService.EntryDetail> entryList = service.GetEntryList(); // build an new list of just the entry detail adn save back to service List <ResistorCalculatorService.EntryDetail> entries = new List <ResistorCalculatorService.EntryDetail>(); foreach (KeyValuePair <int, ResistorCalculatorService.EntryDetail> entry in entryList) { ResistorCalculatorService.EntryDetail entryDetail = entry.Value; entries.Add(entryDetail); } service.SaveEntryList(entries.ToArray()); // get the updated entry list post save to service Dictionary <int, ResistorCalculatorService.EntryDetail> entryList2 = service.GetEntryList(); // Assert Assert.AreEqual(entryList.Count, entryList2.Count); }
private static void InitData() { // get dictionary of all avaiable bands and their specification from the web service // this is done first so we can use them with the entries data ResistorCalculatorService.ResistorCalculatorServiceClient service = new ResistorCalculatorService.ResistorCalculatorServiceClient(); Dictionary <int, ResistorCalculatorService.BandDetail> bandColors = service.GetBandList(); List <Band> bands = new List <Band>(); foreach (KeyValuePair <int, ResistorCalculatorService.BandDetail> band in bandColors) { ResistorCalculatorService.BandDetail bandItem = (ResistorCalculatorService.BandDetail)band.Value; Band bandColor = new Band(band.Key, bandItem); bands.Add(bandColor); } // get dictionary of all avaiable bands and their specification from the web service Dictionary <int, ResistorCalculatorService.EntryDetail> entryList = service.GetEntryList(); List <Entry> entries = new List <Entry>(); foreach (KeyValuePair <int, ResistorCalculatorService.EntryDetail> entry in entryList) { ResistorCalculatorService.EntryDetail entryItem = (ResistorCalculatorService.EntryDetail)entry.Value; Entry entryData = new Entry(entryItem.ID, entryItem); entries.Add(entryData); } // set the static lists Bands = bands; Entries = entries; }
public void GetEntryList() { // Arrange ResistorCalculatorService.ResistorCalculatorServiceClient service = new ResistorCalculatorService.ResistorCalculatorServiceClient(); // Act Dictionary <int, ResistorCalculatorService.EntryDetail> entryList = service.GetEntryList(); // Assert Assert.AreEqual(entryList.Count, entryList.Last().Key); }