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);
        }
 private static void InitializeMockDimensions()
 {
     _mockEndecaDimensions = new List <IDimension>();
     foreach (var dimProps in _mockEndecaDimensionProps)
     {
         _mockEndecaDimensions.Add(MockEndecaDimensionGenerator.GetMockEndecaDimension(dimProps));
     }
     _mockEndecaDimensions[0].DimNode.DimNodes = _mockEndecaDimensionNodes.ToArray();
 }
 private static void InitializeMockEndecaDimensionNodes()
 {
     _mockEndecaDimensionNodes = new List <IDimensionNode>
     {
         MockEndecaDimensionGenerator.GetMockEndecaDimensionNode(new EndecaDimensionProps
         {
             Id         = 40,
             Name       = "Fourtieth Dimension",
             NameFrench = "Fourtieth Dimension Fr"
         }),
         MockEndecaDimensionGenerator.GetMockEndecaDimensionNode(new EndecaDimensionProps
         {
             Id         = 38,
             Name       = "Thirty Eight Dimension",
             NameFrench = "Thirty Eight Dimension Fr"
         })
     };
 }
        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));
        }