Пример #1
0
        public void Create_AddSpecificWeighting_EnsureItIsInlist(int digit)
        {
            // Arrange
            var modulusWeightingFactory = new ModulusWeightingFactory();
            var weightingDto            = new WeightingDto()
            {
                SortCodeFrom    = "202020",
                SortCodeTo      = "202040",
                Method          = ModulusMethod.DBLAL,
                WeightingValues = new List <WeightingValue>()
                {
                    new WeightingValue()
                    {
                        WeightingId = 100,
                        Value       = 0,
                        Digit       = digit
                    }
                }
            };

            // Act
            var weightingDetails = modulusWeightingFactory.Create(weightingDto);

            // Assert
            Assert.AreEqual(true, weightingDetails.Contains(new ModulusWeightingDigit(digit)));
        }
Пример #2
0
        public void Create_PassFullyPopulatedWeightingsDto_ReturnsObjectWithExpectedValues(string expectedFromSortCode, string expectedToSortCode, ModulusMethod sourceMethod, ModulusCheckingMethod expectedMethod)
        {
            // Arrange
            var modulusWeightingFactory = new ModulusWeightingFactory();
            var weightingDto            = new WeightingDto()
            {
                SortCodeFrom    = expectedFromSortCode,
                SortCodeTo      = expectedToSortCode,
                Method          = sourceMethod,
                WeightingValues = new List <WeightingValue>()
            };

            // Act
            var weightingDetails = modulusWeightingFactory.Create(weightingDto);

            // Assert
            Assert.AreEqual(expectedFromSortCode, weightingDetails.FromSortCode);
            Assert.AreEqual(expectedToSortCode, weightingDetails.ToSortCode);
            Assert.AreEqual(expectedMethod, weightingDetails.CheckingMethod);
        }
Пример #3
0
 public ModulusController(IWeightingsRepository weightingsRepository, ModulusWeightingFactory modulusWeightingFactory)
 {
     _modulusParametersFactory = new ModulusParametersFactory(new ModulusWeightingTable(weightingsRepository.GetAllWeightings().Select(modulusWeightingFactory.Create)));
 }