Exemple #1
0
 private void Start()
 {
     _renderer                   = GetComponent <SpriteRenderer>();
     _collider                   = GetComponent <BoxCollider2D>();
     _update                     = CheckIfVisible;
     _unitService                = ServiceLocator.Get <UnitService>();
     _units                      = _unitService.GetAllUnits();
     _unitService.UnitCreated   += OnUnitCreated;
     _unitService.UnitDestroyed += OnUnitDestroyed;
 }
Exemple #2
0
    public void GetAllUnits()
    {
        using var context = new InMemoryDbContext();
        context.Units.Add(new Unit("Piece"));
        context.Units.Add(new Unit("Bag"));
        context.SaveChanges();
        var testee = new UnitService(new SimpleCrudHelper(context, TestMapper.Create()));

        var results = testee.GetAllUnits();

        results.Should().Contain(x => x.Name == "Piece").And.Contain(x => x.Name == "Bag");
    }
Exemple #3
0
        public DefinitionsModel(UnitService unitService)
        {
            this.Difficulties = EnumModel <Difficulty> .GetEnumModels();

            this.IngredientTypes = EnumModel <IngredientType> .GetEnumModels();

            this.Spicies = EnumModel <Spicy> .GetEnumModels();

            this.UnitCategories = EnumModel <UnitCategory> .GetEnumModels();

            this.Units = unitService.GetAllUnits();
        }