Пример #1
0
        public void ConstructorSetsTileImageCountTo0IfSmallFileIdsEmpty()
        {
            var project     = CreateProjectStructureHelper(false, false, false);
            var projectCard = new ProjectCardModel(MockMakerClient.Object, project);

            Assert.AreEqual(0, projectCard.TileImageCount);
        }
Пример #2
0
        public ProjectCardModel GetCardDetails()
        {
            WaitForPageToLoad(webdriver);

            ProjectCardModel model = new ProjectCardModel();

            model.Title              = webdriver.FindElement(projectTitle).Text.Trim();
            model.Subtitle           = webdriver.FindElement(projectSubtitle).Text.Trim();
            model.Description        = webdriver.FindElement(projectDescription).Text.Trim();
            model.RequirementSummary = webdriver.FindElement(reqSummary).Text.Trim();

            string[] reqMetArray = webdriver.FindElement(reqMet).Text.Split(new[] { "Met" }, StringSplitOptions.None);
            model.ReqMet = reqMetArray[0].Trim();
            string[] reqMetKVArray = reqMetArray[1].Trim().Split(new[] { " " }, StringSplitOptions.None);
            model.ReqMetKV = reqMetKVArray[0].Trim();

            string[] reqPartialArray = webdriver.FindElement(reqPartial).Text.Split(new[] { "Partially Met" }, StringSplitOptions.None);
            model.ReqPartiallyMet = reqPartialArray[0].Trim();
            string[] reqPartialKVArray = reqPartialArray[1].Trim().Split(new[] { " " }, StringSplitOptions.None);
            model.ReqPartiallyMetKV = reqPartialKVArray[0].Trim();

            string[] reqNotMetArray = webdriver.FindElement(reqNotMet).Text.Split(new[] { "Not Met" }, StringSplitOptions.None);
            model.ReqNotMet = reqNotMetArray[0].Trim();
            string[] reqNotMetKVArray = reqNotMetArray[1].Trim().Split(new[] { " " }, StringSplitOptions.None);
            model.ReqNotMetKV = reqNotMetKVArray[0].Trim();
            return(model);
        }
Пример #3
0
        public void ConstructorWillNotSetMasterFileImageIfLargeFileIdEmpty()
        {
            var project     = CreateProjectStructureHelper(true, false, false);
            var projectCard = new ProjectCardModel(MockMakerClient.Object, project);

            Assert.IsTrue(String.IsNullOrEmpty(projectCard.MasterFileName));
        }
Пример #4
0
        public void ConstructorSetMosaicLocationToEmptyIfMosaicNotGenerated()
        {
            var project     = CreateProjectStructureHelper(true, true, false);
            var projectCard = new ProjectCardModel(MockMakerClient.Object, project);

            Assert.IsTrue(String.IsNullOrEmpty(projectCard.MosaicLocation));
        }
Пример #5
0
        public void ConstructorWillNotSetMasterFileImageIfFileReturnedEmpty()
        {
            var project = CreateProjectStructureHelper(true, true, true);

            MockMakerClient.Setup(x => x.ReadImageFile(It.Is <string>(p => p.Equals(project.LargeFileId)))).Returns(new ImageFileResponse()
            {
            });

            var projectCard = new ProjectCardModel(MockMakerClient.Object, project);

            Assert.IsTrue(String.IsNullOrEmpty(projectCard.MasterFileName));
        }
Пример #6
0
        public void ConstructorPopulatesAllPropertiesIfMosaicGenerated()
        {
            var project  = CreateProjectStructureHelper(true, true, true);
            var response = new ImageFileResponse()
            {
                File = new ImageFileIndexStructure()
                {
                    Id = project.LargeFileId, FileName = "ImageFile.jpg"
                }
            };

            MockMakerClient.Setup(x => x.ReadImageFile(It.Is <string>(p => p.Equals(project.LargeFileId)))).Returns(response);

            var projectCard = new ProjectCardModel(MockMakerClient.Object, project);

            Assert.AreEqual(response.File.FileName, projectCard.MasterFileName);
        }
Пример #7
0
        public void ThenTheFirstProjectCardContains(string title, string subtitle, string description, string summary, string met, string metKV, string partial, string partialKV, string notMet, string notMetKV)
        {
            ProjectCardModel actualModel   = landingPage.GetCardDetails();
            ProjectCardModel expectedModel = new ProjectCardModel();

            expectedModel.Title              = title;
            expectedModel.Subtitle           = subtitle;
            expectedModel.Description        = description;
            expectedModel.RequirementSummary = summary;
            expectedModel.ReqMet             = met;
            expectedModel.ReqMetKV           = metKV;
            expectedModel.ReqPartiallyMet    = partial;
            expectedModel.ReqPartiallyMetKV  = partialKV;
            expectedModel.ReqNotMet          = notMet;
            expectedModel.ReqNotMetKV        = notMetKV;
            var expectedModelLikeness = new Likeness <ProjectCardModel, ProjectCardModel>(expectedModel);

            expectedModelLikeness.ShouldEqual(actualModel);
        }