Ejemplo n.º 1
0
    static void Main(string[] args)
    {
        string[] inputs = Console.ReadLine().Split(' ');
        int      height = int.Parse(inputs[0]);
        int      width  = int.Parse(inputs[1]);

        List <List <ISlot> > map = new List <List <ISlot> >();
        int         x = 0, y = 0;
        SlotFactory factory = new SlotFactory();

        for (int o = 0; o < height; o++)
        {
            string row = Console.ReadLine();
            int    idx = row.IndexOf("@");
            if (idx >= 0)
            {
                x = idx;
                y = o;
            }

            map.Add(row.ToCharArray().Select((c, a) => factory.GetSlot(c, a, o)).ToList());
        }
        Bender bender = new Bender(map, x, y);

        bender.GoToHell();
    }
Ejemplo n.º 2
0
 public AnswerSlotLayoutCreator(float tileWidth, int tilesPerRow, float startHeight, SlotFactory slotFactory)
 {
     _tileWidth = tileWidth;
     _tilesPerRow = tilesPerRow;
     _startHeight = startHeight;
     _slotFactory = slotFactory;
 }
Ejemplo n.º 3
0
        public void GetSlotShouldReturnNetworkingEventTypeWithProperDetails()
        {
            var slot            = SlotFactory.GetSlot("Networking Session", defaultTitle, startTime, duration, duration);
            var networkingEvent = slot as NetworkingEvent;

            Assert.Equal(defaultTitle, slot.Title);
            Assert.Equal(duration, networkingEvent.DefaultStartTime);
        }
Ejemplo n.º 4
0
        public void GetSlotShouldReturnLunchBreakWithProperDetails()
        {
            var slot = SlotFactory.GetSlot("Lunch Break", defaultTitle, startTime, duration, duration);

            Assert.Equal(defaultTitle, slot.Title);
            Assert.Equal(startTime, slot.StartTime);
            Assert.Equal(duration, slot.Duration);
        }
Ejemplo n.º 5
0
        public void GetSlotShouldReturnSessionWithProperDetails()
        {
            var slot = SlotFactory.GetSlot(defaultCategory, defaultTitle, startTime, duration, duration);

            Assert.Equal(defaultTitle, slot.Title);
            Assert.Equal(startTime, slot.StartTime);
            Assert.Equal(duration, slot.Duration);
        }
Ejemplo n.º 6
0
        public void CreateSlot_Should_Not_Be_Null()
        {
            var symbolFactory = new Mock <ISymbolFactory>().Object;
            var slotFactory   = new SlotFactory(symbolFactory);

            var result = slotFactory.CreateSlot();

            Assert.NotNull(result);
        }
Ejemplo n.º 7
0
        public void CreateSloty_Should_Return_Object_Of_Type_Slot()
        {
            var symbolFactory = new Mock <ISymbolFactory>().Object;
            var slotFactory   = new SlotFactory(symbolFactory);

            var result = slotFactory.CreateSlot();

            Assert.IsType <Slot>(result);
        }
Ejemplo n.º 8
0
        public void CreateSlot_Should_Be_AssignableFrom_ISlot_Interface()
        {
            var symbolFactory = new Mock <ISymbolFactory>().Object;
            var slotFactory   = new SlotFactory(symbolFactory);

            var result = slotFactory.CreateSlot();

            Assert.IsAssignableFrom <ISlot>(result);
        }
Ejemplo n.º 9
0
    void Awake()
    {
        _nameInputManager = new NameInputManager(answer);
        _nameInputManager.ListenTo(_answerSlotPool);

        _slotFactory = new SlotFactory(tilePrefab, slotPrefab, _slotPool, _answerSlotPool);

        _answerSlotLayoutCreator = new AnswerSlotLayoutCreator(tileWidth, tilesPerRow, slotsY, _slotFactory);
        _tileLayoutCreator = new TileLayoutCreator(tileWidth, tilesPerRow, tilesY, _slotFactory);

        _answerSlotLayoutCreator.CreateAnswerSlotLayout(answer.Length);
        _tileLayoutCreator.CreateTileLayout(tiles);
    }
Ejemplo n.º 10
0
    void Awake()
    {
        if(TransitionData.CurrentLevel.answer != null)
        {
            answer = TransitionData.CurrentLevel.answer;
            image.texture = Resources.Load(TransitionData.CurrentLevel.image) as Texture;
        }

        _answerManager = new AnswerManager(answer, OnWon);
        _answerManager.ListenTo(_answerSlotPool);

        _slotFactory = new SlotFactory(tilePrefab, slotPrefab, _slotPool, _answerSlotPool);
        _tileLayoutCreator = new TileLayoutCreator(tileWidth, tilesPerRow, tilesY, _slotFactory);
        _answerSlotLayoutCreator = new AnswerSlotLayoutCreator(tileWidth, tilesPerRow, slotsY, _slotFactory);

        _tileLayoutCreator.CreateTileLayout(GenerateTileLettersFromAnswer());
        _answerSlotLayoutCreator.CreateAnswerSlotLayout(answer.Length);
    }
Ejemplo n.º 11
0
        public void GetSlotShouldReturnNetworkingEventTypeForNetworkingSessionCategory()
        {
            var slot = SlotFactory.GetSlot("Networking Session", defaultTitle, startTime, duration, duration);

            Assert.IsType <NetworkingEvent>(slot);
        }
Ejemplo n.º 12
0
        public void GetSlotShouldReturnLunchBreakTypeForLunchBreakCategory()
        {
            var slot = SlotFactory.GetSlot("Lunch Break", defaultTitle, startTime, duration, duration);

            Assert.IsType <LunchBreak>(slot);
        }
Ejemplo n.º 13
0
        public void GetSlotShouldReturnSessionTypeForSessionCategory()
        {
            var session = SlotFactory.GetSlot(defaultCategory, defaultTitle, startTime, duration, duration);

            Assert.IsType <Session>(session);
        }
Ejemplo n.º 14
0
 public void GetSlotShouldThrowArgumentNullExceptionIfTitleIsNull()
 {
     Assert.Throws <ArgumentException>(() => SlotFactory.GetSlot(defaultCategory, null, startTime, duration, duration));
 }
Ejemplo n.º 15
0
 public void GetSlotShouldThrowArgumentExceptionIfCategoryIsInvalid()
 {
     Assert.Throws <ArgumentException>(() => SlotFactory.GetSlot("Invalid Category", defaultTitle, startTime, duration, duration));
 }