public List<NavigationTab> Build()
        {
            var list = new List<NavigationTab>();

            if (customJewelPersistenceBase.DiamondID > 0 )
            {
                diamond = diamondRepository.GetDiamondByID(customJewelPersistenceBase.DiamondID);
            }

            if (customJewelPersistenceBase.SettingID > 0)
            {
                setting = jewelRepository.GetJewelByID(customJewelPersistenceBase.SettingID);
            }

            var diamondTab = BuildDiamondTab();
            list.Add(diamondTab);

            var settingTab = BuildSettingTab();
            list.Add(settingTab);

            var finalTab = BuildFinalTab();

            list.Add(finalTab);

            list = list.Select(ForEachTabEvaluateTheHighlightCSSClass).ToList();

            return list;
        }
예제 #2
0
        public Dictionary<string, DiamondHelpViewModel> Build(Diamond diamond)
        {
            var dic = new Dictionary<string, DiamondHelpViewModel>();

            dic["cut"] = CreateModelFor("cut", diamond.Cut);
            dic["color"] = CreateModelFor("color", diamond.Color);
            dic["clarity"] = CreateModelFor("clarity", diamond.Clarity);

            return dic;
        }
        public void Build_ReturnTheRightBodyForColorAsAnExmpleForAllOtherAsItsTheSameAlgorithm()
        {
            //Arrange
            var diamond = new Diamond()
            {
                Color = "H",
                Clarity = "VVS1",
                Cut = "VG"
            };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);
            //Assert
            list["color"].CurrentValueOfHelp.Should().Be("H");
        }
        public void Build_ReturnNAForTheBodyTextWhenTheXmlDoesntContainTheDefinition()
        {
            //Arrange
            var diamond = new Diamond()
                              {
                                  Color = "P",
                                  Clarity = "VVS1",
                                  Cut = "VG"
                              };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);
            //Assert
            list["color"].BodyText.Should().Be("N/A");
        }
        public void Build_ReturnTheAllTheValuesForColorAsAnExmpleForAllOtherAsItsTheSameAlgorithm()
        {
            //Arrange
            var diamond = new Diamond()
            {
                Color = "H",
                Clarity = "VVS1",
                Cut = "VG"
            };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);
            //Assert
            list["color"].HelpValues.Should().Contain("E");
            list["color"].HelpValues.Should().Contain("F");
            list["color"].HelpValues.Should().Contain("G");
            list["color"].HelpValues.Should().Contain("H");
        }
        public void Build_ShouldReturnThreeHelpItems()
        {
            //Arrange
            var diamond = new Diamond()
                              {
                                  Color = "H",
                                  Clarity = "VVS1",
                                  Cut = "VG"
                              };

            var xmlSourceFactory = new FakeXmlSourceFactory();

            var builder = new DiamondHelpBuilder(xmlSourceFactory);
            //Act
            var list = builder.Build(diamond);
            //Assert
            list.Should().HaveCount(3);
        }