|
1 | | -// Copyright (c) 2009-2013 SIL International |
| 1 | +// Copyright (c) 2009-2013 SIL International |
2 | 2 | // This software is licensed under the LGPL, version 2.1 or later |
3 | 3 | // (http://www.gnu.org/licenses/lgpl-2.1.html) |
4 | 4 | // |
@@ -260,6 +260,40 @@ private ILexSense AddSense(ILexEntry entry, string gloss) |
260 | 260 | } |
261 | 261 | } |
262 | 262 |
|
| 263 | + #region ConstituentChartCellPartRepository Tests |
| 264 | + /// ---------------------------------------------------------------------------------------- |
| 265 | + /// <summary> |
| 266 | + /// Class to test additions to ConstituentChartCellPartRepository functionality. |
| 267 | + /// </summary> |
| 268 | + /// ---------------------------------------------------------------------------------------- |
| 269 | + [TestFixture] |
| 270 | + public class ConstituentChartCellPartRepositoryTests : MemoryOnlyBackendProviderRestoredForEachTestTestBase |
| 271 | + { |
| 272 | + /// <summary> |
| 273 | + /// Test InstancesWithChartCellColumn |
| 274 | + /// </summary> |
| 275 | + [Test] |
| 276 | + public void InstancesWithChartCellColumn() |
| 277 | + { |
| 278 | + var repo = (ConstituentChartCellPartRepository)Cache.ServiceLocator.GetInstance<IConstituentChartCellPartRepository>(); |
| 279 | + ICmPossibility template = Cache.LangProject.GetDefaultChartTemplate(); |
| 280 | + IDsConstChart chart = SetupChart(template); // This DOES add the chart as a reference to the template. |
| 281 | + |
| 282 | + IEnumerable<IConstituentChartCellPart> chartCells = repo.InstancesWithChartCellColumn(template); |
| 283 | + Assert.AreEqual(1, template.ReferringObjects.Count(), "The chart should be included as a referring object"); |
| 284 | + Assert.AreEqual(0, chartCells.Count(), "The chart should not be included as a chart cell"); |
| 285 | + } |
| 286 | + |
| 287 | + private IDsConstChart SetupChart(ICmPossibility template) |
| 288 | + { |
| 289 | + var servLoc = Cache.ServiceLocator; |
| 290 | + var text = servLoc.GetInstance<ITextFactory>().Create(); |
| 291 | + var stText = servLoc.GetInstance<IStTextFactory>().Create(); |
| 292 | + text.ContentsOA = stText; |
| 293 | + return servLoc.GetInstance<IDsConstChartFactory>().Create(Cache.LangProject.DiscourseDataOA, stText, template); |
| 294 | + } |
| 295 | + } |
| 296 | + #endregion |
263 | 297 |
|
264 | 298 | #region PunctuationFormRepository Tests |
265 | 299 | /// ---------------------------------------------------------------------------------------- |
|
0 commit comments