public void GetMegalightsToTravelTest()
        {
            //// Arrange
            _getStarshipEnduranceRequest = new GetStarshipEnduranceRequest(100);

            //// Act
            var response = _getStarshipEnduranceRequest.GetMegalightsToTravel();

            //// Assert
            Assert.AreEqual(100, response);
        }
Beispiel #2
0
        public GetStarshipsEnduranceResponse GetStarshipsEndurance(GetStarshipEnduranceRequest request)
        {
            var starshipEntities = _starshipRepository.GetStarshipEntities();

            var response = new GetStarshipsEnduranceResponse(new List <KeyValuePair <string, string> >());

            foreach (var starship in starshipEntities)
            {
                var starshipEnduranceDetails = _starshipResupplyCalculation.CalculateNumberOfResupplyStopsNeeded(starship, request.GetMegalightsToTravel());

                response.GetStarshipsEnduranceDetails().Add(starshipEnduranceDetails);
            }

            return(response);
        }
Beispiel #3
0
        public void GetStarshipsEnduranceTest()
        {
            ////Arrange
            _starshipRepositoryMock.Setup(x => x.GetStarshipEntities())
            .Returns(new List <StarshipEntity>()
            {
                new StarshipEntity("entity1", "80", "1 week")
            })
            .Verifiable();
            _starshipResupplyCalculationMock.Setup(x => x.CalculateNumberOfResupplyStopsNeeded(It.IsAny <StarshipEntity>(), It.IsAny <int>()))
            .Returns(new KeyValuePair <string, string>("entity1", "5"));

            var request = new GetStarshipEnduranceRequest(1000000);

            ////Act
            var response = _applicationService.GetStarshipsEndurance(request);
            var details  = response.GetStarshipsEnduranceDetails();

            ////Assert
            Assert.AreEqual(1, details.Count);
            Assert.AreEqual("entity1", details[0].Key);
            Assert.AreEqual("5", details[0].Value);
        }
 public void Init()
 {
     _getStarshipEnduranceRequest = new GetStarshipEnduranceRequest();
 }