Ejemplo n.º 1
0
        public static FeatureListVm ResultToFeatureListVm(GetFeaturesQueryResult results, IConfiguration config)
        {
            if (results == null)
            {
                throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "results"));
            }

            if (config == null)
            {
                throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "config"));
            }

            FeatureListVm vm = new FeatureListVm();

            vm.ItemsFound = results.Features.Count > 0;

            if (!vm.ItemsFound)
            {
                vm.Message      = MessagesModel.NoItemsFound;
                vm.MessageStyle = MessagesModel.MessageStyles.Info;
            }

            foreach (var result in results.Features)
            {
                FeatureListItemVm feature = ResultToFeatureListItemVm(result, config);
                vm.Features.Add(feature);
            }

            return(vm);
        }
Ejemplo n.º 2
0
            public void ResultToFeatureListVm_Should_Throw_Exception_When_Results_Is_Null()
            {
                GetFeaturesQueryResult results = null;

                IConfiguration config = GetConfig();

                FeatureListVm actual = FeatureModelHelper.ResultToFeatureListVm(results, config);
            }
Ejemplo n.º 3
0
            public void ResultToFeatureListVm_Should_Throw_Exception_When_Config_Is_Null()
            {
                ICollection <Feature>  features = new List <Feature>();
                GetFeaturesQueryResult results  = new GetFeaturesQueryResult(features);

                IConfiguration config = null;

                FeatureListVm actual = FeatureModelHelper.ResultToFeatureListVm(results, config);
            }
        public void TestSetup()
        {
            var specFlowReportGenerator = new SpecFlowReportGenerator(TestConstants.ROOT_TESTDATA, "en-US");
            feature_list = specFlowReportGenerator.GetSpecFlowFeatures();
            nUnitReportParser = new NUnitReportParser(TestConstants.ROOT_TESTDATA + @"\NUnitReport\TestResult.xml");

            reportCreator = new FeatureDocReportCreator(feature_list, nUnitReportParser);
            
            result = reportCreator.CreateFeatureDocReport();
        }
Ejemplo n.º 5
0
            public void ResultToFeatureListVm_Should_Return_FeatureListVm_When_No_Items_Found()
            {
                ICollection <Feature>  features = new List <Feature>();
                GetFeaturesQueryResult results  = new GetFeaturesQueryResult(features);

                IConfiguration config = GetConfig();

                FeatureListVm actual = FeatureModelHelper.ResultToFeatureListVm(results, config);

                Assert.AreEqual(MessagesModel.NoItemsFound, actual.Message);
                Assert.AreEqual(MessagesModel.MessageStyles.Info, actual.MessageStyle);
            }
Ejemplo n.º 6
0
        public FeatureListVm GetFeatures(GetFeaturesQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "query"));
            }

            GetFeaturesQueryResult results = this.queryDispatcher.Dispatch <GetFeaturesQuery, GetFeaturesQueryResult, Feature>(query);

            FeatureListVm vm = FeatureModelHelper.ResultToFeatureListVm(results, this.config);

            return(vm);
        }
Ejemplo n.º 7
0
            public void ResultToFeatureListVm_Should_Return_FeatureListVm_When_Items_Found()
            {
                DateTime date = DateTime.Now;
                ICollection <Feature> features = new List <Feature>();
                Feature feature = new Feature("1", date, "Feature1", "testuser");

                features.Add(feature);
                feature = new Feature("2", date, "Feature2", "testuser");
                features.Add(feature);
                feature = new Feature("3", date, "Feature3", "testuser");
                features.Add(feature);
                GetFeaturesQueryResult results = new GetFeaturesQueryResult(features);

                IConfiguration config = GetConfig();

                FeatureListVm actual = FeatureModelHelper.ResultToFeatureListVm(results, config);

                Assert.AreEqual(3, actual.Features.Count);
            }
Ejemplo n.º 8
0
 private void Bind()
 {
     this.Vm = this.model.GetFeatures(this.query);
     this.FeatureGrid.Visible = this.Vm.ItemsFound;
     this.BindGrid(this.Vm.Features);
 }