private void InitWeights(IEnumerable <Item> items, int maxWeight) { var weights = items.Select(item => item.Weight); _weightsService = new WeightsService(weights, maxWeight); Weights = _weightsService.Weights.ToArray(); }
public TestGetRemainingWeight() { var guitar = new Item("guitar", 1500, 1, "$", "pounds"); var player = new Item("player", 3000, 4, "$", "pounds"); var notebook = new Item("notebook", 2000, 3, "$", "pounds"); var items = new [] { guitar.Weight, player.Weight, notebook.Weight }; var maxWeight = 4.0; _weightsService = new WeightsService(items, maxWeight); }
public void Weights_0p6_0p9_2p1_Max_2p1(double a, double b, double specifiedWeight) { // Arrange var weights = new[] { a, b }; var expected = new double[] { 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1 }; // Act var service = new WeightsService(weights, specifiedWeight); // Assert CollectionAssert.AreEqual(expected, service.Weights); }
public void Weights_From_0p5_To_4p0_Max_4p0(double a, double b, double c, double maxWeight) { // Arrange var weights = new[] { a, b, c }; var expected = new double[] { 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4 }; // Act var service = new WeightsService(weights, maxWeight); // Assert CollectionAssert.AreEqual(expected, service.Weights); }
public void Weight_4p0_4p0() { // Arrange var weights = new[] { 4.0 }; var specifiedWeight = 4; var expected = new double[] { 4.0 }; // Act var service = new WeightsService(weights, specifiedWeight); // Assert CollectionAssert.AreEqual(expected, service.Weights); }
public void PrepareWeightsServiceTests() { _weightsRepository = new Mock <IWeightsRepository>(MockBehavior.Strict); _sut = new WeightsService(_weightsRepository.Object); }