Esempio n. 1
0
    private void Awake()
    {
        _templateController = ItemTemplateController.Instance;
        _treasureController = TreasureController.Instance;
        _playerAction       = PlayerAction.Instance;
        _switchScene        = SwitchScene.Instance;
        _itemsReceive       = new Stack <ItemPickUp>();
        _currentSpawnItems  = new List <SpawnItem>();

        ActiveReceiveCanvas(false);
        _itemTemp = _itemPrefab;
    }
Esempio n. 2
0
        public async void GetAllTemplatesFalseTest()
        {
            //Arrange
            var con = new ItemTemplateController(_repo, _dbContext, _mapper, _userManager, _eventLogRepo);

            //Act
            IActionResult allItems = await con.GetItemTemplates();

            OkObjectResult intermediate           = allItems as OkObjectResult;
            List <ItemTemplateForTableDto> result = intermediate.Value as List <ItemTemplateForTableDto>;

            //Asserty
            Assert.False(result.Count != 3);
        }
Esempio n. 3
0
    private void Awake()
    {
        _totalItem                 = 0;
        baseItemShopSlots          = new List <BaseItemSellingSlot>();
        _inventoryContainer        = InventoryContainer.Instance;
        _characterStatusController = CharacterStatusController.Instance;
        _itemTemplateController    = ItemTemplateController.Instance;
        _notificationController    = NotificationController.Instance;
        _placesController          = PlacesController.Instance;
        _storeContoller            = StoreContoller.Instance;

        _placeId = ConvertType.GetPlaceId(_place);

        _inventoryContainer.OnInventoryUpdated.AddListener(Initializing);
    }
Esempio n. 4
0
    private void Awake()
    {
        _totalItem                 = 0;
        baseItemShopSlots          = new List <BaseItemShopSlot>();
        _itemTemplateController    = ItemTemplateController.Instance;
        _notificationController    = NotificationController.Instance;
        _inventoryContainer        = InventoryContainer.Instance;
        _characterStatusController = CharacterStatusController.Instance;
        _placesController          = PlacesController.Instance;

        _storeContoller = StoreContoller.Instance;
        _storeId        = ConvertType.GetStoreId(_storeType);
        _placeId        = ConvertType.GetPlaceId(_place);

        _itemTemp = _itemPrefab;
    }
Esempio n. 5
0
        public async void ShowDetailsTemplateTest()
        {
            //Given
            var con = new ItemTemplateController(_repo, _dbContext, _mapper, _userManager, _eventLogRepo);
            //When

            IActionResult templateResult = await con.GetItemTemplate(1);

            //Then

            OkObjectResult        template = templateResult as OkObjectResult;
            ItemTemplateForGetDto temp     = template.Value as ItemTemplateForGetDto;


            Assert.Equal(temp.Id, 1);
        }
Esempio n. 6
0
        public async void AddTemplateReturnTest()
        {
            //Given
            var con = new ItemTemplateController(_repo, _dbContext, _mapper, _userManager, _eventLogRepo);

            var listTP = new List <TemplatePropertyRelation>();

            listTP.AddRange(_dbContext.TemplatePropertyRelations.Where(x => x.TemplateId == 1));
            listTP.AddRange(_dbContext.TemplatePropertyRelations.Where(x => x.TemplateId == 2));

            var template = new ItemTemplate(
                "Dør",
                new UnitType
            {
                Name = "test"
            },
                "Dette er en Dør",
                listTP,
                new List <ItemTemplatePart>()
            {
            },
                new List <ItemTemplatePart>()
            {
            },
                new DateTime {
            },
                new ItemTemplate {
            },
                new List <TemplateFileName>(),
                0,
                new ItemTemplateCategory {
            }
                );
            //When
            var status = await con.AddItemTemplate(_mapper.Map <ItemTemplateForAddDto>(template));

            StatusCodeResult result = status as StatusCodeResult;
            var test = new StatusCodeResult(201);

            Assert.True(result.StatusCode == test.StatusCode);
        }
Esempio n. 7
0
        public async void AddTemplateTest()
        {
            //Given
            var listTP = new List <TemplatePropertyRelation>();

            listTP.AddRange(_dbContext.TemplatePropertyRelations.Where(x => x.TemplateId == 1));
            listTP.AddRange(_dbContext.TemplatePropertyRelations.Where(x => x.TemplateId == 2));


            var con      = new ItemTemplateController(_repo, _dbContext, _mapper, _userManager, _eventLogRepo);
            var template = new ItemTemplate(
                "Dør",
                new UnitType
            {
                Name = "test"
            },
                "Dette er en Dør",
                listTP,
                new List <ItemTemplatePart>()
            {
            },
                new List <ItemTemplatePart>()
            {
            },
                new DateTime {
            },
                new ItemTemplate {
            },
                new List <TemplateFileName>(),
                0,
                new ItemTemplateCategory {
            }
                );
            //When
            await con.AddItemTemplate(_mapper.Map <ItemTemplateForAddDto>(template));

            var dbTemplate = _dbContext.ItemTemplates.FirstOrDefault(x => x.Name == "Dør");

            //Then
            Assert.True(dbTemplate.Name == template.Name);
        }
Esempio n. 8
0
 private void Awake()
 {
     itemTemplateController = ItemTemplateController.Instance;
 }