public async Task Only()
        {
            ContentType contenttype = client.ContentType(source);

            string uid = await GetUID("source1");

            Entry sourceEntry = contenttype.Entry(uid);

            sourceEntry.Only(new string[] { "title", "number" });
            SourceModel result = await sourceEntry.Fetch <SourceModel>();

            if (result == null)
            {
                Assert.False(true, "Query.Exec is not match with expected result.");
            }
            else
            {
                List <string> uidKeys = new List <string>()
                {
                    "title", "number", "uid"
                };
                bool IsTrue = false;
                //IsTrue = data.Object.Keys.Count == 3 && data.Object.Keys.ToList().Contains(a=>  ui);
                IsTrue = result.Uid != null && result.Title != null && result.Number == 4 ? true : false;
                Assert.True(IsTrue);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Populates the view ViewModel.
        /// </summary>
        /// <returns>
        /// </returns>
        public override void HandleViewDataLoadEvent()
        {
            HLinkSourceModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkSourceModel>((BaseParamsHLink));

            // Cache the Source model
            SourceObject = HLinkObject.DeRef;

            if (!(SourceObject is null))
            {
                // Get basic details
                BaseModelBase = SourceObject;

                // MediaCard = SourceObject.ModelItemGlyph;

                // Header Card
                BaseDetail.Add(new CardListLineCollection("Source Detail")
                {
                    new CardListLine("Title:", SourceObject.GSTitle),
                    new CardListLine("Author:", SourceObject.GSAuthor),
                    new CardListLine("Pub Info:", SourceObject.GSPubInfo),
                    new CardListLine("Abbrev:", SourceObject.GSAbbrev),
                });

                // Add Model details
                BaseDetail.Add(DV.SourceDV.GetModelInfoFormatted(SourceObject));
            }
        }
 public void SetUp()
 {
     _sourceModel                    = new SourceModel(typeof(TestModel));
     _sourceModelEventField          = _sourceModel.EventFields.First(x => x.Name == nameof(TestModel.TestEvent));
     _asyncSourceModelEventField     = _sourceModel.EventFields.First(x => x.Name == nameof(TestModel.AsyncTestEvent));
     _inheritedSourceModelEventField = _sourceModel.EventFields.First(x => x.Name == nameof(TestModel.InheritedTestEvent));
 }
Esempio n. 4
0
        public QueueableSourceComboBox(string source_name)
        {
            // FIXME: Would probably be nice to use this, but variable
            // width reporting in SourceRowRenderer does not work as
            // I would expect, so currently it's forced to 200px wide
            // which causes quite a problem with a UI like Muinshee
            // and the MeeGo Media Panel
            //
            // SourceRowRenderer renderer = new SourceRowRenderer ();
            // renderer.ParentWidget = this;

            var renderer = new CellRendererText();

            PackStart(renderer, true);
            SetCellDataFunc(renderer, new CellLayoutDataFunc(
                                (layout, cell, model, iter) => renderer.Text = ((Source)model.GetValue(iter, 0)).Name
                                ));

            var store = new SourceModel();

            filter             = new TreeModelFilter(store, null);
            filter.VisibleFunc = (model, iter) => IsQueueable(((SourceModel)model).GetSource(iter));
            Model = filter;

            store.Refresh();

            SetActiveSource(source_name);

            HasTooltip    = true;
            QueryTooltip += HandleQueryTooltip;
        }
        public void TestCallsIntermediateTransformersWhenPushing()
        {
            SourceModel       sourceModel       = new SourceModel();
            IntermediateModel intermediateModel = new IntermediateModel();
            DestinationModel  destinationModel  = new DestinationModel();

            Mock <ITransformer <SourceModel, IntermediateModel> >      firstTransformerMock  = new Mock <ITransformer <SourceModel, IntermediateModel> >();
            Mock <ITransformer <IntermediateModel, DestinationModel> > secondTransformerMock = new Mock <ITransformer <IntermediateModel, DestinationModel> >();
            Mock <ITransformer <DestinationModel, IntermediateModel> > thirdTransformerMock  = new Mock <ITransformer <DestinationModel, IntermediateModel> >();
            Mock <ITransformer <IntermediateModel, SourceModel> >      fourthTransformerMock = new Mock <ITransformer <IntermediateModel, SourceModel> >();

            firstTransformerMock.Setup(_ => _.Transform(sourceModel)).Returns(intermediateModel).Verifiable();
            secondTransformerMock.Setup(_ => _.Transform(intermediateModel)).Returns(destinationModel).Verifiable();
            thirdTransformerMock.Setup(_ => _.Transform(destinationModel)).Returns(intermediateModel).Verifiable();
            fourthTransformerMock.Setup(_ => _.Transform(intermediateModel)).Returns(sourceModel).Verifiable();

            TransformerPipeline <SourceModel, IntermediateModel, DestinationModel> transformer =
                new TransformerPipeline <SourceModel, IntermediateModel, DestinationModel>(
                    firstTransformerMock.Object,
                    secondTransformerMock.Object
                    );

            ITransformer <SourceModel, SourceModel> newTransformer =
                transformer
                .PipePush(thirdTransformerMock.Object)
                .PipePush(fourthTransformerMock.Object);

            newTransformer.Transform(sourceModel);

            firstTransformerMock.Verify(_ => _.Transform(sourceModel), Times.Once);
            secondTransformerMock.Verify(_ => _.Transform(intermediateModel), Times.Once);
            thirdTransformerMock.Verify(_ => _.Transform(destinationModel), Times.Once);
            fourthTransformerMock.Verify(_ => _.Transform(intermediateModel), Times.Once);
        }
        public void UpdateSource(SourceModel p)
        {
            Source_of_income ph = db.Sources.GetItem(p.Source_of_income_PK);

            db.Sources.Update(toSource(ph, p));
            db.Save();
        }
        private Source_of_income toSource(Source_of_income p, SourceModel i)
        {
            p.Name_Source_of_income = i.Name_Source_of_income;
            p.Source_of_income_PK   = i.Source_of_income_PK;

            return(p);
        }
Esempio n. 8
0
        public void Install(WindsorContainer container, IMapper mapper)
        {
            container.Register(Component.For <IInitProject>().ImplementedBy <InitProjectImp>().LifestyleSingleton());

            var appSetting = IoC.Resolve <IAppSetting>();
            var test       = RPCTransmitter <ITestClass> .Register(appSetting.GetSetting("RPCTestClass"));

            container.Register(Component.For <ITestClass>().Instance(test).LifestyleSingleton());

            var qs   = appSetting.Get <List <QSettingModel> >("QueueSettings");
            var item = qs.FirstOrDefault(q => q.Name == "WebTestClass");

            container.AddWebReceiverService <WebTestReceiver>(item);
            item = qs.FirstOrDefault(q => q.Name == "RPCTestClass");
            container.AddRpcReceiverService <RpcTestReceiver>(item);

            mapper.Bind <SourceModel, DestModel>()
            .Map(d => d.RandNum, s => new Random().Next(1000));

            var src = new SourceModel()
            {
                Name = "Hello",
                Id   = 100
            };

            var des = src.MapTo <DestModel>();
        }
Esempio n. 9
0
        public async Task <IActionResult> DeleteNotes(SourceModel obj)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ClaimsIdentity claimsIdentity        = User.Identity as ClaimsIdentity;
                    var            currentLoginUserid    = new UserClaims(claimsIdentity).LoggedInUserId;
                    var            currentLoginUserOrgid = new UserClaims(claimsIdentity).OrgId;
                    obj.createdBy = currentLoginUserid;
                    using (var uow = new UnitOfWork(_configs.Value.DbConnectionString))
                    {
                        await uow.Source.DeleteSourceAsync(obj.sourceId, obj.createdBy);

                        uow.Commit();
                        return(Ok(new ApiResponse {
                            message = ApiMessageConstants.commonDeleted
                        }));
                    }
                }
                else
                {
                    return(BadRequest(new ApiResponse {
                        message = ApiMessageConstants.someThingWentWrong
                    }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new ApiResponse {
                    message = ex.Message
                }));
            }
        }
Esempio n. 10
0
        public ResultModel Update(SourceModel obj)
        {
            ResultModel oOutput = new ResultModel();

            try
            {
                Source oSource = dbSet.Where(m => m.ID == obj.ID).FirstOrDefault();
                if (oSource == null)
                {
                    oOutput.Status = 0;
                    oOutput.Msg    = "Record not exist";
                }
                else
                {
                    oSource = Mapper.Map(obj, oSource);
                    oDB.SaveChanges();
                }
                oOutput.Data = oSource;
            }
            catch (Exception ex)
            {
                oOutput.Status = 0;
                oOutput.Msg    = "Data access error";
                Services.Utitilty.Error(ex);
            }
            return(oOutput);
        }
        public static SourceModel SetHomeImage(SourceModel argModel)
        {
            if (argModel is null)
            {
                throw new ArgumentNullException(nameof(argModel));
            }

            // Get default image if available
            HLinkHomeImageModel hlink = argModel.GMediaRefCollection.FirstHLinkHomeImage;

            // Set default
            if (!hlink.Valid)
            {
                argModel.HomeImageHLink.HomeImageType = CommonConstants.HomeImageTypeSymbol;
                argModel.HomeImageHLink.HomeSymbol    = CommonConstants.IconSource;
            }
            else
            {
                argModel.HomeImageHLink.HomeImageType = CommonConstants.HomeImageTypeThumbNail;
                argModel.HomeImageHLink.HLinkKey      = hlink.HLinkKey;
            }

            // Get colour Get colour
            Application.Current.Resources.TryGetValue("CardBackGroundSource", out var varCardColour);
            argModel.HomeImageHLink.HomeSymbolColour = (Color)varCardColour;

            return(argModel);
        }
        private int CalculateNumberOfDayAbsent(int year, int month, List <SourceModel> sourceList, List <WorkerLeaveModel> workerLeaveList, List <HolidayModel> holidayList)
        {
            int      numberOfDayAbsent = 0;
            DateTime startDate         = new DateTime(year, month, 1);
            DateTime endDate           = startDate.AddDays(DateTime.DaysInMonth(year, month) - 1);

            for (DateTime date = startDate; date <= endDate; date = date.AddDays(1))
            {
                SourceModel source = sourceList.Where(s => s.Date.Date == date.Date).FirstOrDefault();
                if (source == null && date.DayOfWeek != DayOfWeek.Sunday && holidayList.Select(h => h.Date.Date).Contains(date.Date) == false)
                {
                    List <WorkerLeaveModel> workerLeaveList_D1 = workerLeaveList.Where(w => w.StartDate.Date <= date.Date && date.Date <= w.EndDate.Date).ToList();
                    if (workerLeaveList_D1.Count > 0)
                    {
                        WorkerLeaveModel workerLeave = workerLeaveList_D1.OrderBy(w => w.CreatedDate).Last();
                        LeaveTypeModel   leaveType   = leaveTypeList.Where(l => l.LeaveTypeId == workerLeave.LeaveType).FirstOrDefault();
                        if (leaveType != null && leaveType.HaveIncentive == false)
                        {
                            numberOfDayAbsent += 1;
                        }
                    }
                    else
                    {
                        numberOfDayAbsent += 1;
                    }
                }
            }
            return(numberOfDayAbsent);
        }
        public void SetUp()
        {
            _routingServiceMock = new Mock <IRoutingService>(MockBehavior.Strict);
            _eventsScopeMock    = new Mock <IEventsScope>(MockBehavior.Strict);

            _sourceModel       = new SourceModel(typeof(TestSource));
            _forwardingService = new ForwardingService(_routingServiceMock.Object);
        }
 private void OnDestroy()
 {
     if (model != null)
     {
         model.Dispose();
     }
     model = null;
 }
 private void Start()
 {
     model = LoadModel(vpkPath, modelPath, flatTextures, maxTextureSize);
     if (model != null)
     {
         model.InstantiateGameObject().transform.SetParent(transform, false);
     }
 }
Esempio n. 16
0
    public override void initializeState(EntityModel model)
    {
        this.spriteRenderer = GetComponent <SpriteRenderer>();
        base.initializeState(model);
        SourceModel source = (SourceModel)model;

        Instantiate <GameObject>(sourcePrefabs[(int)source.FoodModelProto.type], transform);
    }
Esempio n. 17
0
        public void ShouldFailValidationOnNullModel()
        {
            var         validator = new SourceModelValidator();
            SourceModel model     = null;
            var         result    = validator.Validate(model);

            result.ShouldBeFalse();
        }
 public DownloadedItemModel(SourceModel source, string title, string downloadUrl, string refererUrl, string savedLocation)
 {
     Source        = source;
     Title         = title;
     DownloadUrl   = downloadUrl;
     RefererUrl    = refererUrl;
     SavedLocation = SavedLocation;
 }
 public SourcePathController(List <string> fullFilesNames, List <string> directoriesNeedCopy, List <string> filesNames)
 {
     model = new SourceModel
     {
         DirectoriesNeedCopy = directoriesNeedCopy,
         FilesNames          = filesNames,
         FullFilesNames      = fullFilesNames
     };
 }
Esempio n. 20
0
 public static void AddFeed(FeedModel fm, SourceModel source, bool isActive = false)
 {
     fm.Source = source;
     if (isActive)
     {
         fm.Source.ActiveFeeds.Add(fm);
     }
     fm.IsActive = isActive;
 }
 private void EnsureLoggingSection()
 {
     loggingSection = GetSectionOfType <LoggingSettings>();
     if (loggingSection == null)
     {
         loggingSectionIsNew = true;
         loggingSection      = SourceModel.AddSection(LoggingSettings.SectionName, new LoggingSettings());
     }
 }
    public void Custom_MappingAction_Test()
    {
        var sourceModel = new SourceModel
        {
            Name = "Source"
        };

        _objectMapper.Map <SourceModel, DestModel>(sourceModel).Name.ShouldBe(nameof(CustomMappingActionService));
    }
Esempio n. 23
0
        public void Execute_AddsSourceToDatabase()
        {
            var mockSourceRepository = new Mock <ISourceRepository>();
            var createSourceCommand  = new CreateSourceCommand(mockSourceRepository.Object);
            var sourceModel          = new SourceModel();

            createSourceCommand.Execute(sourceModel);
            mockSourceRepository.Verify(r => r.Add(It.IsAny <Source>()), Times.Once);
        }
    public void Should_Custom_Service_Construction()
    {
        var source = new SourceModel
        {
            Name = nameof(SourceModel)
        };

        _objectMapper.Map <SourceModel, DestModel>(source).Name.ShouldBe(nameof(CustomMappingAction));
    }
Esempio n. 25
0
        public void ShouldPassValidationOnNullModel()
        {
            var validator = new SourceModelValidator();
            var model     = new SourceModel {
                Items = new[] { "One", "Two" }
            };
            var result = validator.Validate(model);

            result.ShouldBeTrue();
        }
            private void EnsureExceptionHandlingSection()
            {
                exceptionSettingsSection = GetSectionOfType <ExceptionHandlingSettings>();

                if (exceptionSettingsSection == null)
                {
                    var section = new ExceptionHandlingSettings();
                    exceptionSettingsSection = SourceModel.AddSection(ExceptionHandlingSettings.SectionName, section);
                }
            }
        public void ShouldReturnNullObjectIfNullList()
        {
            var converter = CreateConverter(false);
            var source    = new SourceModel {
                Items = null
            };
            var destination = converter.Convert(source, null, null);

            destination.ShouldBeNull();
        }
    public SourceModel LoadModel(string vpkLoc, string modelLoc, bool flatTextures = false, int maxTextureSize = 2048)
    {
        SourceTexture.averageTextures = flatTextures;
        SourceTexture.maxTextureSize  = maxTextureSize;

        SourceModel model = null;

        using (VPKParser vpk = new VPKParser(vpkPath))
            model = SourceModel.GrabModel(null, vpk, modelPath);
        return(model);
    }
        public void ShouldReturnEqualValuesIfListOfOne()
        {
            var converter = CreateConverter(true);
            var source    = new SourceModel {
                Items = new[] { "One" }
            };
            var destination = converter.Convert(source, null, null);

            destination.FirstItem.ShouldEqual("One");
            destination.LastItem.ShouldEqual("One");
        }
Esempio n. 30
0
            private SectionViewModel EnsureConnectionStringsSection()
            {
                var connectionStringsSection = GetSectionOfType <ConnectionStringsSection>();

                if (connectionStringsSection == null)
                {
                    connectionStringsSection = SourceModel.AddSection("connectionStrings", new ConnectionStringsSection());
                }

                return(connectionStringsSection);
            }