public void Calculate_InvalidStarshipConsumables_ReturnUnknown()
        {
            //Arrange
            var userInput = 1000000;
            var starship  = fixture.Build <Starship>()
                            .With(property => property.Mglt, fixture.Create <int>().ToString())
                            .Create();

            //Act
            var result = resupplyCalculatorService.Calculate(userInput, starship);

            //Assert
            result.Should().NotBeNull();
            result.Should().Be(ResupplyConstants.Unknown);
        }
예제 #2
0
 /// <summary>
 /// Calculates the specified megalights for a given starship.
 /// </summary>
 /// <param name="megalights">The megalights.</param>
 /// <param name="starship">The starship.</param>
 /// <returns>A <see cref="string"/> object.</returns>
 public string Calculate(decimal megalights, Starship starship)
 {
     return(resupplyCalculatorService.Calculate(megalights, new Domain.Model.Starship.Starship
     {
         Consumables = starship.Consumables,
         Mglt = starship.Mglt
     }));
 }
예제 #3
0
        public void Calculate_CallsService_ReturnValue()
        {
            //Arrange
            var resultService = fixture.Create <string>();
            var megalights    = fixture.Create <decimal>();
            var starship      = fixture.Create <StarshipResupply.Application.Dto.Starship.Starship>();

            resupplyCalculatorService.Calculate(Arg.Any <decimal>(), Arg.Any <Starship>()).Returns(resultService);

            //Act
            var result = resupplyService.Calculate(megalights, starship);

            //Assert
            result.Should().Be(resultService);
            resupplyCalculatorService.Received(1).Calculate(Arg.Any <decimal>(), Arg.Any <Starship>());
        }