public void Check_if_GetAssetDetailsByEmpCode_returns_a_list_of_AssetDetails()
        {
            //Arrange
            var    mockService = new Mock <IAssetControllerService>();
            Assets asset       = new Assets {
                AssetId = 1, AssetCode = "124", AssetStatus = 0, ReassignedTo = "122"
            };
            List <Assets> assetList = new List <Assets>();

            assetList.Add(asset);
            //setting up service with mock data
            mockService.Setup(x => x.GetAssetDetailsByEmpcode(It.IsAny <string>())).Returns(assetList);
            //assigning constructor with the mock service
            AssetController obj = new AssetController(mockService.Object);

            //Act
            IActionResult result = obj.Get("00054967");

            var result2 = result as OkObjectResult;

            Assert.Equal(200, result2.StatusCode);
            //Assert.Equal(assetList, result2.Value);
            //Assert.NotNull(result);
            //Assert.IsType(typeof(List<AssetDetails>), result);
        }
Beispiel #2
0
 public OverlayBlockDefinitionItemModel(BlockDefinition b, IdeCollection <IdeBaseItem> source) : base(source) // load overlay
 {
     _def  = b;
     Asset = new AssetController(AssetType.Image);
     Asset.Register(b.src);
     Asset.PropertyChanged += AssetUpdated;
 }
        public void Test_The_Return_Type_to_be_Ok_result_of_GetDiscrepantRecords_Method_when_list_is_returned()
        {
            //Arranges
            List <AssetControllerDiscrepancyReport> assetList = new List <AssetControllerDiscrepancyReport>
            {
                new AssetControllerDiscrepancyReport {
                    RequestId = 1, RepEmployeeCode = "12345678", RepEmployeeName = "Rajiv"
                },
                new AssetControllerDiscrepancyReport {
                    RequestId = 2, RepEmployeeCode = "12345679", RepEmployeeName = "Rajeev"
                }
            };
            var mockService = new Mock <IAssetControllerService>(); //mocking service

            //setting up service with mock data
            mockService.Setup(m => m.GetDiscrepantRecords()).Returns(assetList);
            //assigning constructor with the mock service
            AssetController obj = new AssetController(mockService.Object);

            // Act
            IActionResult action1 = obj.GetDiscrepantRequest();

            action1 = (OkObjectResult)action1;

            // Assert
            Assert.IsType <OkObjectResult>(action1);
            Assert.Equal(assetList, (action1 as OkObjectResult).Value);
        }
Beispiel #4
0
 public GameModeItemModel(GameMode g, IdeCollection <IdeBaseItem> source) : base(source) // load item
 {
     _gameMode = g;
     Asset     = new AssetController(AssetType.Image);
     Asset.Register(g.Image);
     Asset.PropertyChanged += AssetUpdated;
 }
        public static async Task <List <Asset> > AssetsAsync()
        {
            var a = await AssetController.GetAllAssetsAsync();

            Global.AssetCache = a;
            return(a);
        }
Beispiel #6
0
 public SymbolItemModel(Symbol s, IdeCollection <IdeBaseItem> source) : base(source) // load item
 {
     _symbol = s;
     Asset   = new AssetController(AssetType.Image);
     Asset.Register(s.Source);
     Asset.PropertyChanged += AssetUpdated;
 }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void EditAsset_Click(object sender, DirectEventArgs e)
        {
            if (!int.TryParse(hdfKeyRecord.Text, out var id) || id <= 0)
            {
                return;
            }
            var asset = AssetController.GetById(id);

            if (asset != null)
            {
                cbxSelectedEmployee.Text   = asset.FullName;
                hdfEmployeeSelectedId.Text = asset.RecordId.ToString();
                txtAssetName.Text          = asset.AssetName;
                txtAssetCode.Text          = asset.AssetCode;
                txtNote.Text     = asset.Note;
                txtQuantity.Text = asset.Quantity.ToString();
                txtStatus.Text   = asset.Status;
                txtUnitCode.Text = asset.UnitCode;
            }

            // show window
            btnUpdate.Show();
            btnUpdateNew.Hide();
            btnUpdateClose.Hide();
            cbxSelectedEmployee.Disabled = true;
            wdAsset.Title = @"Cập nhật thông tin công cụ cấp phát";
            wdAsset.Show();
        }
Beispiel #8
0
        public GroupItemModel(Group g, IdeCollection <IdeBaseItem> source) : base(source) //load
        {
            NewActionCommand    = new RelayCommand <IdeCollection <IdeBaseItem> >(NewAction);
            NewSubmenuCommand   = new RelayCommand <IdeCollection <IdeBaseItem> >(NewSubmenu);
            NewSeparatorCommand = new RelayCommand <IdeCollection <IdeBaseItem> >(NewSeparator);
            ActionsDropHandler  = new ActionsDropHandler();

            _group       = g;
            GroupActions = new IdeCollection <IdeBaseItem>(this);
            foreach (var action in g.GroupActions)
            {
                GroupActions.Add(IBaseAction.CreateActionItem(action, GroupActions));
            }
            GroupActions.CollectionChanged += (a, b) =>
            {
                _group.GroupActions = GroupActions.Select(x => ((IBaseAction)x)._action);
            };
            CardActions = new IdeCollection <IdeBaseItem>(this);
            foreach (var action in g.CardActions)
            {
                CardActions.Add(IBaseAction.CreateActionItem(action, CardActions));
            }
            CardActions.CollectionChanged += (a, b) =>
            {
                _group.CardActions = CardActions.Select(x => ((IBaseAction)x)._action);
            };
            Asset = new AssetController(AssetType.Image);
            Asset.Register(g.Icon);
            Asset.PropertyChanged += AssetUpdated;
        }
Beispiel #9
0
 public MarkerItemModel(GameMarker m, IdeCollection <IdeBaseItem> source) : base(source)
 {
     _marker = m;
     Asset   = new AssetController(AssetType.Image);
     Asset.Register(m.Source);
     Asset.PropertyChanged += AssetUpdated;
 }
Beispiel #10
0
 public PhaseItemModel(GamePhase p, IdeCollection <IdeBaseItem> source) : base(source)
 {
     _phase = p;
     Asset  = new AssetController(AssetType.Image);
     Asset.Register(p.Icon);
     Asset.PropertyChanged += AssetUpdated;
 }
        public void Test_The_Return_Type_to_be_Ok_result_of_Get_Method_when_list_is_returned()
        {
            //Arranges
            //initialisations
            List <AssetDetails> assetList = new List <AssetDetails>
            {
                new AssetDetails {
                    AssetId = 1, AssetCode = "124", AssetStatus = 0, ReAssignedTo = "122"
                },
                new AssetDetails {
                    AssetId = 2, AssetCode = "124", AssetStatus = 0, ReAssignedTo = "122"
                }
            };

            //mocking the service
            var mockService = new Mock <IAssetControllerService>();

            //setting up the response for the mocked service
            mockService.Setup(m => m.GetRequestStatus()).Returns(assetList);
            AssetController obj = new AssetController(mockService.Object);

            // Act
            IActionResult action1 = obj.Get();

            action1 = (OkObjectResult)action1;

            // Assert
            Assert.IsType <OkObjectResult>(action1);
            Assert.Equal(assetList, (action1 as OkObjectResult).Value);
        }
Beispiel #12
0
 public override void Initiate()
 {
     foreach (var sticker in STICKERS_NAMES)
     {
         mStickerList.Add(Instantiate(AssetController.GetGameObject("SimpleImage"), stickersParent).AddComponent <Sticker>().SetupSticker(sticker, false));
     }
 }
Beispiel #13
0
 public ScriptItemModel(GameScript gameScript, IdeCollection <IdeBaseItem> source) : base(source) // load item
 {
     _script = gameScript;
     Asset   = new AssetController(AssetType.PythonScript);
     Asset.Register(gameScript.Path);
     Asset.PropertyChanged += AssetUpdated;
     ScriptDocument         = new TextDocument(gameScript.Script);
 }
 public static SettingsDBData Setting(string guid)
 {
     try
     {
         return(AssetController.GetSetting(guid));
     }
     catch { return(null); }
 }
 public static bool AppSettings()
 {
     try
     {
         return(AssetController.PushSettings(Global.Library.Settings));
     }
     catch { return(false); }
 }
 public static bool Setting(SettingsDBData data)
 {
     try
     {
         return(AssetController.PushSetting(data));
     }
     catch { return(false); }
 }
 public static Asset Asset(string num)
 {
     try
     {
         return(AssetController.GetAsset(num));
     }
     catch { return(null); }
 }
 public static bool Asset(Asset asset)
 {
     try
     {
         return(AssetController.UpdateAsset(asset));
     }
     catch { return(false); }
 }
Beispiel #19
0
 public GameModeItemModel(IdeCollection <IdeBaseItem> source) : base(source) // new item
 {
     _gameMode              = new GameMode();
     Name                   = "New Game Mode";
     Asset                  = new AssetController(AssetType.Image);
     Asset.PropertyChanged += AssetUpdated;
     _gameMode.Image        = Asset.FullPath;
 }
Beispiel #20
0
 public BoardItemModel(GameBoard g, IdeCollection <IdeBaseItem> source) : base(source) // load item
 {
     CanBeDefault = true;
     _board       = g;
     Asset        = new AssetController(AssetType.Image);
     Asset.Register(g.Source);
     Asset.PropertyChanged += AssetUpdated;
 }
Beispiel #21
0
 public PileItemModel(IdeCollection <IdeBaseItem> source) : base(source) //new item
 {
     Asset                  = new AssetController(AssetType.Image);
     _group.Icon            = Asset.FullPath;
     Asset.PropertyChanged += AssetUpdated;
     RaisePropertyChanged("Asset");
     Name = "New Group";
 }
 public static bool Library()
 {
     try
     {
         Global.Library.Assets = AssetController.GetAllAssets();
         return(true);
     }
     catch { Global.Library = new AssetLibrary(); return(false); }
 }
Beispiel #23
0
 public TableItemModel(Group group, IdeCollection <IdeBaseItem> src) : base(group, src)
 {
     Background = new AssetController(AssetType.Image);
     Background.Register(group.Background);
     Background.PropertyChanged += BackgroundAssetUpdated;
     Zoom = 1;
     CenterView();
     SetBackground();
 }
Beispiel #24
0
    protected override void Awake()
    {
        base.Awake();

        transform.Find("Icon").GetComponent <Image>().sprite = AssetController.GetSprite(buttonSpriteName);
        transform.Find("Text").GetComponent <Text>().text    = buttonText;

        onClick.AddListener(OnClick);
    }
Beispiel #25
0
    protected override void Awake()
    {
        var temp = gameObject.GetComponent <Image>();

        mImage = temp != null ? temp : Instantiate(AssetController.GetGameObject("SimpleImage"), transform).GetComponent <Image>();
        mImage.preserveAspect = true;

        base.Awake();
    }
Beispiel #26
0
 public CounterItemModel(Counter c, IdeCollection <IdeBaseItem> source) : base(source)
 {
     _counter = c;
     Asset    = new AssetController(AssetType.Image);
     Asset.Register(c.Icon);
     Asset.PropertyChanged += AssetUpdated;
     IncreaseCommand        = new RelayCommand(IncreaseValue);
     DecreaseCommand        = new RelayCommand(DecreaseValue);
 }
Beispiel #27
0
 public SymbolItemModel(IdeCollection <IdeBaseItem> source) : base(source) // new item
 {
     _symbol                = new Symbol();
     Name                   = "New Symbol";
     Id                     = "symbol";
     Asset                  = new AssetController(AssetType.Image);
     _symbol.Source         = Asset.FullPath;
     Asset.PropertyChanged += AssetUpdated;
 }
Beispiel #28
0
        public SoundItemModel(GameSound s, IdeCollection <IdeBaseItem> source) : base(source) // load item
        {
            PlayCommand = new RelayCommand(PlaySound);
            StopCommand = new RelayCommand(StopSound);

            _sound = s;
            Asset  = new AssetController(AssetType.Sound);
            Asset.Register(s.Src);
            Asset.PropertyChanged += AssetUpdated;
        }
Beispiel #29
0
 public TextBlockDefinitionItemModel(TextBlockDefinitionItemModel t, IdeCollection <IdeBaseItem> source) : base(source) // copy
 {
     _def            = new BlockDefinition();
     Asset           = new AssetController(AssetType.Font);
     Asset.CanRemove = true;
     Asset.Register(t._def.src);
     Asset.PropertyChanged += AssetUpdated;
     _def.text.font         = Asset.SelectedAsset.FullPath;
     Name = t.Name;
 }
Beispiel #30
0
 public SymbolItemModel(SymbolItemModel s, IdeCollection <IdeBaseItem> source) : base(source) // copy item
 {
     _symbol = new Symbol();
     Asset   = new AssetController(AssetType.Image);
     Asset.Register(s._symbol.Source);
     _symbol.Source         = Asset.FullPath;
     Asset.PropertyChanged += AssetUpdated;
     Name = s.Name;
     Id   = s.Id;
 }