Example #1
0
        public void Serialize_Propeller_Model_Success()
        {
            using (var db = SharedDatabaseDefinition.StarwarsDatabase())
            {
                using (ShareMediaProvider.MediaProvider())
                {
                    // Arrange
                    var model = SharedDatabaseDefinition.StaticVehichleData;

                    // Act
                    var jsonStr = JsonConvert.SerializeObject(model);

                    // Assert
                    jsonStr.Length.Should().BeGreaterThan(10);
                }
            }
        }
Example #2
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
            }
        }
Example #3
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);
            }
        }
Example #4
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);
            }
        }
Example #5
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);
            }
        }
Example #6
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");
            }
        }
Example #7
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);
                }
            }
        }
        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);
                }
            }
        }