public Extract_string_value_to_model_property()
        {
            EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var mappingProcessor = new MappingProcessor();

            mappingProcessor.Process(null);
        }
Пример #2
0
        public ActionResult Index()
        {
            var mappingProcessor = new MappingProcessor();

            mappingProcessor.Process(null);


            var characterViewModel = new CharacterViewModel(RenderingContext.Current.Rendering);

            ViewBag.SerializedModel = JsonConvert.SerializeObject(characterViewModel, Formatting.Indented);
            return(View(characterViewModel));
        }
Пример #3
0
        public void DateTime_type_success()
        {
            // Arrange
            EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var mappingProcessor = new MappingProcessor();

            mappingProcessor.Process(null);
            var factory = new ModelFactory();

            using (var db = SharedDatabaseDefinition.StarwarsDatabase())
            {
                // Act
                var item         = db.GetItem("/sitecore/content/Astra");
                var carViewModel = factory.Create <VehichleModel>(item);

                // Assert
            }
        }
Пример #4
0
        public void GetIsFromAMultilist()
        {
            using (var db = SharedDatabaseDefinition.CpuListDatabase())
            {
                // Arrange
                EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                var mappingProcessor = new MappingProcessor();
                mappingProcessor.Process(null);
                var factory = new ModelFactory();

                // Act
                var item      = db.GetItem("/sitecore/content/IntelCps");
                var intelCpus = factory.Create <CpuSelectionModel>(item);

                // Assert
                intelCpus.SelectedCps.Split('|').Should().HaveCount(2);
            }
        }
Пример #5
0
        public void boolean_is_true_Success()
        {
            // Arrange
            EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var mappingProcessor = new MappingProcessor();

            mappingProcessor.Process(null);
            var factory = new ModelFactory();


            using (var db = SharedDatabaseDefinition.StarwarsDatabase())
            {
                // Act
                var item         = db.GetItem("/sitecore/content/XWing");
                var carViewModel = factory.Create <VehichleModel>(item);

                // Assert
                carViewModel.HasHyperdrive.Should().Be(true);
            }
        }
Пример #6
0
        public void GeneralLinkAdapter_ExternalLink_Success()
        {
            // Arrange
            EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var mappingProcessor = new MappingProcessor();

            mappingProcessor.Process(null);
            var factory = new ModelFactory();

            using (var db = SharedDatabaseDefinition.StarwarsDatabase())
            {
                // Act
                var item         = db.GetItem("/sitecore/content/XWing");
                var carViewModel = factory.Create <VehichleModel>(item);

                // Assert
                carViewModel.WikiLink.Url.Should().Be(SharedDatabaseDefinition.StaticVehichleData.WikiLink.Url);
                carViewModel.WikiLink.Desciption.Should().Be(SharedDatabaseDefinition.StaticVehichleData.WikiLink.Desciption);
            }
        }
Пример #7
0
        public void CircularReferenceBetweenTwoViewModels()
        {
            using (var db = SharedDatabaseDefinition.CpuDatabase())
            {
                // Arrange
                EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                var mappingProcessor = new MappingProcessor();
                mappingProcessor.Process(null);
                var factory = new ModelFactory();

                // Act
                var item       = db.GetItem("/sitecore/content/Haswell");
                var haswellCpu = factory.Create <CpuModel>(item);

                // Assert
                haswellCpu.ArchitectureName.ShouldBeEquivalentTo("Haswell");
                haswellCpu.Predecessor.ArchitectureName.Should().Be("Ivy Bridge");
                haswellCpu.Predecessor.Successor.ArchitectureName.Should().Be("Haswell");
            }
        }
Пример #8
0
        public void Get_a_single_reference_viewmodel_with_its_properties_populated_Success()
        {
            using (var db = SharedDatabaseDefinition.StarwarsDatabase())
            {
                using (ShareMediaProvider.MediaProvider())
                {
                    // Arrange
                    EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                    var mappingProcessor = new MappingProcessor();
                    mappingProcessor.Process(null);
                    var factory = new ModelFactory();

                    // Act
                    var item           = db.GetItem("/sitecore/content/XWing");
                    var xwingViewModel = factory.Create <VehichleModel>(item);

                    // Assert
                    xwingViewModel.Name.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Name);
                    xwingViewModel.Length.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Length);
                    xwingViewModel.CargoKg.Should().Be(SharedDatabaseDefinition.StaticVehichleData.CargoKg);
                    xwingViewModel.HasHyperdrive.Should().Be(SharedDatabaseDefinition.StaticVehichleData.HasHyperdrive);

                    xwingViewModel.WikiLink.Desciption.Should().Be(SharedDatabaseDefinition.StaticVehichleData.WikiLink.Desciption);
                    xwingViewModel.WikiLink.Url.Should().Be(SharedDatabaseDefinition.StaticVehichleData.WikiLink.Url);
                    xwingViewModel.WikiLink.LinkType.Should().Be(SharedDatabaseDefinition.StaticVehichleData.WikiLink.LinkType);

                    xwingViewModel.Photo.Url.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Photo.Url);
                    xwingViewModel.Photo.Alt.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Photo.Alt);

                    xwingViewModel.ClassModel.Name.Should().Be(SharedDatabaseDefinition.StaticVehichleData.ClassModel.Name);

                    xwingViewModel.Appearances.Should().HaveCount(SharedDatabaseDefinition.StaticVehichleData.Appearances.Count());
                    xwingViewModel.Appearances.Last().Title.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Appearances.First().Title);
                    xwingViewModel.Appearances.Last().ReleaseDate.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Appearances.First().ReleaseDate);
                    xwingViewModel.Appearances.First().Title.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Appearances.Last().Title);
                    xwingViewModel.Appearances.First().ReleaseDate.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Appearances.Last().ReleaseDate);
                }
            }
        }
Пример #9
0
        public void ImageAdapter_Success()
        {
            // Arrange
            EnvironmentSetttings.ApplicationPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var mappingProcessor = new MappingProcessor();

            mappingProcessor.Process(null);
            var factory = new ModelFactory();

            using (var db = SharedDatabaseDefinition.StarwarsDatabase())
            {
                using (ShareMediaProvider.MediaProvider())
                {
                    // Act
                    var item         = db.GetItem("/sitecore/content/XWing");
                    var carViewModel = factory.Create <VehichleModel>(item);

                    // Assert
                    carViewModel.Photo.Alt.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Photo.Alt);
                    carViewModel.Photo.Url.Should().Be(SharedDatabaseDefinition.StaticVehichleData.Photo.Url);
                }
            }
        }