public void If_no_field_is_filled_Then_return_false()
        {
            IFieldFactory fieldFactory = Substitute.For <IFieldFactory>();

            fieldFactory.Create().Returns(new Field());
            var match = new Match(fieldFactory);

            match.IsFinished.Should().BeFalse();
        }
Ejemplo n.º 2
0
        public void Reset()
        {
            LastMove = null;

            fields = new IField[Height, Width];
            for (int i = 0; i < fields.GetLength(0); i++)
            {
                for (int j = 0; j < fields.GetLength(1); j++)
                {
                    fields[i, j] = fieldFactory.Create(i, j);
                }
            }
        }
        public void If_some_fields_are_filled_Then_return_false()
        {
            IFieldFactory fieldFactory = Substitute.For <IFieldFactory>();

            fieldFactory.Create().Returns(
                new Field()
            {
                State = FieldState.O
            },
                new Field()
            {
                State = null
            },
                new Field()
            {
                State = FieldState.O
            },
                new Field()
            {
                State = FieldState.X
            },
                new Field()
            {
                State = null
            },
                new Field()
            {
                State = null
            },
                new Field()
            {
                State = FieldState.O
            },
                new Field()
            {
                State = FieldState.X
            },
                new Field()
            {
                State = null
            });
            var match = new Match(fieldFactory);

            match.IsFinished.Should().BeFalse();
        }
Ejemplo n.º 4
0
        private object CreateViewModel(ModelBindingContext bindingContext)
        {
            var fieldType = bindingContext.ValueProvider.GetValue(GetFieldTypeKey(bindingContext)).AttemptedValue;

            return(fieldFactory.Create(fieldType));
        }