// GET: Admin/Works/Edit/5
        public ActionResult Edit(int id)
        {
            var speciality = db.Specialties.FirstOrDefault(p => p.id == id);

            if (speciality != null)
            {
                Covers specCover = db.Covers.FirstOrDefault(c => c.Page == "Specialties");
                string cover     = "";
                if (specCover != null)
                {
                    cover = db.Covers.FirstOrDefault(c => c.Page == "Specialties").Photo;
                }
                else
                {
                    cover = null;
                }

                var model = new SpecViewModel()
                {
                    Specialy    = db.Specialties.FirstOrDefault(s => s.id == id),
                    Specialties = db.Specialties.ToList(),
                    Cover       = cover,
                    Header      = "Edit Specialty",
                    Action      = "Edit"
                };

                return(View("Index", model));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #2
0
        public void CreateTest()
        {
            Guid specId = Guid.NewGuid();
            Spec spec   = new Spec()
            {
                Id     = specId,
                Name   = "Spec 1",
                Status = SpecStatus.Passed,
                Suite  = null,
                Time   = 100,
                Steps  = new SpecStep[]
                {
                    new SpecStep {
                        Message = "Step 1", Status = SpecStatus.Running, Trace = "Step 1 Trace line 1\nTrace line 2\nTrace line 3"
                    },
                    new SpecStep {
                        Message = "Step 2", Status = SpecStatus.Failed, Trace = "Step 2 Trace line 1\nTrace line 2\nTrace line 3"
                    },
                }
            };

            SpecViewModel.Create(spec).ShouldBeEquivalentTo(spec, o => o
                                                            .Excluding(si => si.PropertyPath.EndsWith("IsNotifying"))
                                                            .Excluding(si => si.PropertyPath == "Statuses")
                                                            .Excluding(si => si.PropertyPath == "Duration"));
        }
Beispiel #3
0
        private SpecViewModel GetSpecViewModel(string runnerId, Spec spec)
        {
            if (spec == null)
            {
                return(null);
            }

            SuiteViewModel suiteViewModel = GetSuiteViewModel(runnerId, spec.Suite, spec.Time);

            if (suiteViewModel == null)
            {
                return(null);
            }

            SpecViewModel specViewModel = suiteViewModel.Specs.FirstOrDefault(s => s.IsSpec(spec));

            if (specViewModel == null)
            {
                specViewModel = SpecViewModel.Create(spec);
                suiteViewModel.Specs.Add(specViewModel);
            }
            else
            {
                specViewModel.Time = spec.Time;
            }
            specViewModel.SetStatus(runnerId, spec.Status, spec.Time, spec.Steps, _FileLocationParser, _FileLocationMapper);
            return(specViewModel);
        }
Beispiel #4
0
        private static string GetCompositeName(SpecViewModel svm)
        {
            // If href does not exists, return full name
            if (string.IsNullOrEmpty(svm.Uid))
            {
                return(System.Web.HttpUtility.HtmlEncode(svm.FullName));
            }

            // If href exists, return name with href
            return(ApiBuildOutputUtility.GetXref(svm.Uid, svm.FullName, svm.Name));
        }
Beispiel #5
0
        private static string GetCompositeName(SpecViewModel svm)
        {
            // If href does not exists, return full name
            if (string.IsNullOrEmpty(svm.Uid))
            {
                return(HttpUtility.HtmlEncode(svm.FullName));
            }

            // If href exists, return name with href
            return(ModelConverter.GetXref(svm.Uid, svm.Name, svm.FullName));
        }
        public void ChildrenTest()
        {
            SpecViewModel spec = new SpecViewModel();

            _SuiteViewModel.Specs.Add(spec);
            SuiteViewModel suite = new SuiteViewModel();

            _SuiteViewModel.Suites.Add(suite);
            ((CollectionContainer)_SuiteViewModel.Children[0]).Collection.Cast <object>()
            .Union(((CollectionContainer)_SuiteViewModel.Children[1]).Collection.Cast <object>())
            .ShouldAllBeEquivalentTo(new object[] { spec, suite });
        }
Beispiel #7
0
        public static SpecViewModel GetSpec(string idspec)
        {
            SpecViewModel viewModel = null;
            Spec          spec      = GetALL().Where(en => en.idspec == idspec).FirstOrDefault();

            if (spec != null)
            {
                viewModel = new SpecViewModel();
                viewModel.CopyFromBase(spec);
                Merc merc = MercService.GetMerc(viewModel.idmerc);
                viewModel.merc = merc != null ? merc.merc1 : "";
            }
            return(viewModel);
        }
Beispiel #8
0
        public ActionResult Save(SpecViewModel model)
        {
            var id = specProvider.SaveSpec(model.Spec);

            alloyTemperProvider.Save(id, model.AlloyTempersToAdd);

            equivSpecProvider.Save(id, model.EquivSpecsToAdd);

            costImpactProvider.Save(id, model.CostImpactsToAdd);

            deliveryImpactProvider.Save(id, model.DeliveryImpactsToAdd);

            return(RedirectToRoute("spec.index"));
        }
Beispiel #9
0
        public ActionResult Details(int id)
        {
            var result = specProvider.SpecDetails(id);
            var model  = new SpecViewModel
            {
                Spec               = result.Spec,
                EquivSpecs         = result.EquivSpecs,
                SpecAlloyTemper    = result.SpecAlloyTemper,
                SpecCostImpact     = result.SpecCostImpact,
                SpecDeliveryImpact = result.SpecDeliveryImpact,
                SpecNotes          = result.SpecNotes
            };

            return(View(model));
        }
Beispiel #10
0
        public static SpecViewModel ToSpecViewModel(this LinkItem model)
        {
            if (model == null)
            {
                return(null);
            }
            var result = new SpecViewModel
            {
                Uid        = model.Name,
                Name       = model.DisplayName,
                FullName   = model.DisplayQualifiedNames,
                IsExternal = model.IsExternalPath,
                Href       = model.Href,
            };

            return(result);
        }
Beispiel #11
0
        public static List <SpecViewModel> GetSpecsByIdMerc(int idmerc)
        {
            List <SpecViewModel> specs = new List <SpecViewModel>();
            TN          tn             = new TN();
            List <Spec> entities       = GetALL().Where(en => en.idmerc == idmerc).ToList();

            if (entities != null && entities.Count > 0)
            {
                specs = entities.Select(model => {
                    SpecViewModel viewModel = new SpecViewModel();
                    viewModel.CopyFromBase(model);
                    return(viewModel);
                }).ToList();
                List <Merc> mercs = tn.Mercs.ToList();
                specs = specs.Select(en => {
                    Merc merc = mercs.Find(model => model.idmerc == en.idmerc);
                    en.merc   = merc != null ? merc.merc1 : "";
                    return(en);
                }).ToList();
            }

            return(specs);
        }
        // GET: Admin/Works
        public ActionResult Index()
        {
            Covers special = db.Covers.FirstOrDefault(c => c.Page == "Specialties");
            string cover   = "";

            if (special != null)
            {
                cover = db.Covers.FirstOrDefault(c => c.Page == "Specialties").Photo;
            }
            else
            {
                cover = null;
            }
            var model = new SpecViewModel()
            {
                Cover       = cover,
                Specialy    = new Specialties(),
                Specialties = db.Specialties.ToList(),
                Header      = "Yeni ixtisas elave edin",
                Action      = "Create"
            };

            return(View(model));
        }
Beispiel #13
0
            private void CheckSpec(Spec spec)
            {
                _Reporter.Suites.ShouldAllBeEquivalentTo(new Suite[] { spec.Suite.ParentSuite }, o => o.ExcludingMissingProperties());
                _Reporter.Suites.First().Suites.ShouldAllBeEquivalentTo(new Suite[] { spec.Suite }, o => o.ExcludingMissingProperties());
                _Reporter.Suites.First().Suites.First().Specs.Should().HaveCount(1);

                SpecViewModel reportersSpec = _Reporter.Suites.First().Suites.First().Specs.First();

                reportersSpec.ShouldBeEquivalentTo(spec, o => o.Excluding(si => si.PropertyPath == "Statuses" || si.PropertyPath == "Duration" || si.PropertyPath.EndsWith("IsNotifying")));
                reportersSpec.Statuses.Should().HaveCount(1);
                SpecStatusViewModel status = reportersSpec.Statuses.First().Value;

                status.Status.Should().Be(spec.Status);
                status.Description.Should().Contain(spec.Status.ToString());
                if (spec.Steps != null)
                {
                    foreach (SpecStep step in spec.Steps)
                    {
                        status.Description.Should().Contain(step.Message);
                        status.Description.Should().Contain(step.Status.ToString());
                        status.Description.Should().Contain(step.Trace);
                    }
                }
            }
Beispiel #14
0
 public void Setup()
 {
     _SpecViewModel = new SpecViewModel();
 }
Beispiel #15
0
 string AnchorName(TestClassViewModel c, SpecViewModel spec)
 {
     return("Scenario-" + (c.Namespace + "." + c.Name + "-" + spec.MethodName).Replace(" ", "_"));
 }