public void CanAddDimensionValueToDimension() { var adapter = new EndecaDimensionAdapter(_mockEndecaDimensionFileAdapter.Object, new[] { "1", "2" }); var newDimNode = MockEndecaDimensionGenerator.GetMockEndecaDimensionNode(new EndecaDimensionProps { Id = 79, Name = "New Dim Node", NameFrench = "New Dim Node Fr" }); adapter.AddDimensionNodeToDimension(newDimNode, 1, 38); var actual = adapter.GetAllEndecaDimensions() .FirstOrDefault(d => d.DimId.Id == 1) .DimNode.DimNodes.FirstOrDefault(n => n.DimVal.DimValId.Id == 38) .DimNodes; Assert.IsTrue(actual.Length == 1); var insertedNode = actual.FirstOrDefault(n => n.DimVal.DimValId.Id == 79); Assert.IsNotNull(insertedNode); Assert.AreEqual(insertedNode, newDimNode); }
public void CanSaveDimensionsToFiles() { var adapter = new EndecaDimensionAdapter(_mockEndecaDimensionFileAdapter.Object, new[] { "1", "2" }); var newDimNode = MockEndecaDimensionGenerator.GetMockEndecaDimensionNode(new EndecaDimensionProps { Id = 79, Name = "New Dim Node", NameFrench = "New Dim Node Fr" }); adapter.AddDimensionNodeToDimension(newDimNode, 1, 38); adapter.SaveAllDimensionFiles(); var actual = adapter.GetAllEndecaDimensionXmls(); Assert.AreEqual(_mockSavedFiles.Count(), actual.Count); Assert.IsTrue(actual.ScrambledEquals(_mockSavedFiles.Values)); }