Ejemplo n.º 1
0
 public void Setup()
 {
     request = new BattleshipRequest()
     {
         Length      = 2,
         Orientation = "vertical",
         Position    = new Coordinates {
             X = 2, Y = 3
         }
     };
     validationService = new Mock <IValidationService>();
     cacheService      = new Mock <ICacheService>();
     trackerService    = new TrackerService(cacheService.Object, validationService.Object);
 }
Ejemplo n.º 2
0
        public void IsValidPosition_Should_return_true_or_false_based_on_input_position(int length, string orientation, int xPostion, int yPosition,
                                                                                        bool isExpected, int expectedEndPosition, Orientation expecetedEnum)
        {
            // Arrange
            request = new BattleshipRequest()
            {
                Length      = length,
                Orientation = orientation,
                Position    = new Coordinates {
                    X = xPostion, Y = yPosition
                }
            };

            // Act
            var actual = validationService.IsValidPosition(request, 5);

            // Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(isExpected, actual.Item1);
            Assert.AreEqual(expectedEndPosition, actual.Item2);
            Assert.AreEqual(expecetedEnum, actual.Item3);
        }