Beispiel #1
0
        [Test] public void Find_NonExistingCriteria_ReturnsNull()
        {
            var model  = RegionMother.CreateSimpleTree();
            var result = model.Find(region => region.Name.Equals("Non existing"));

            Assert.That(result, Is.Null);
        }
Beispiel #2
0
        public void Ctor_WithNullPeriodRoot_ThrowsArgumentNullException()
        {
            var amount     = 1000m;
            var regionRoot = RegionMother.CreateSimpleTree();

            new EstimatedSaleCube(amount, regionRoot, null);
        }
Beispiel #3
0
        public void Find_ExistingCriteria_ReturnsFirstSingleRegionMeetingCriteria()
        {
            var model  = RegionMother.CreateSimpleTree();
            var result = model.Find(region => region.Name.Equals("Warsaw"));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Name, Is.EqualTo("Warsaw"));
        }
Beispiel #4
0
        public void Ctor_WithNegativeAmount_ThrowsArgumentOutOfRangeException()
        {
            var amount     = -100m;
            var regionRoot = RegionMother.CreateSimpleTree();
            var periodRoot = PeriodMother.CreateSimpleTree();

            new EstimatedSaleCube(amount, regionRoot, periodRoot);
        }
Beispiel #5
0
        public void Ctor_WithValidArguments_Test()
        {
            var amount = 1000m;
            var region = RegionMother.CreateSimpleModel();
            var period = PeriodMother.CreateSimpleModel();
            var model  = new EstimatedSaleAllocation(amount, region, period);

            Assert.That(model.Amount, Is.EqualTo(amount));
            Assert.That(model.RegionDimension, Is.EqualTo(region));
            Assert.That(model.PeriodDimension, Is.EqualTo(period));
        }
Beispiel #6
0
        public void Ctor_WithValidArguments_CreatesModel()
        {
            var amount     = 1000m;
            var regionRoot = RegionMother.CreateSimpleTree();
            var periodRoot = PeriodMother.CreateSimpleTree();
            var model      = new EstimatedSaleCube(amount, regionRoot, periodRoot);

            Assert.That(model.Amount, Is.EqualTo(amount));
            Assert.That(model.RegionRoot, Is.EqualTo(regionRoot));
            Assert.That(model.PeriodRoot, Is.EqualTo(periodRoot));
        }
Beispiel #7
0
        public void GetEnumerator_SimpleTree_Returns10Nodes()
        {
            var root    = RegionMother.CreateSimpleTree();
            var counter = 0;

            foreach (var item in root)
            {
                counter++;
            }

            Assert.That(counter, Is.EqualTo(10));
        }
Beispiel #8
0
        public void FindAll_ExistingCriteria_ReturnsList()
        {
            var model  = RegionMother.CreateSimpleTree();
            var result = model.FindAll(region => region.IsLeaf);

            Assert.That(result, Is.Not.Null);
            var counter = 0;

            foreach (var item in result)
            {
                Assert.That(item.IsLeaf);
                counter++;
            }
            // There is 6 cities
            Assert.That(counter, Is.EqualTo(6));
        }
Beispiel #9
0
        public static EstimatedSaleAllocation CreateSimpleModel()
        {
            var amount = 1000m;

            return(new EstimatedSaleAllocation(amount, RegionMother.CreateSimpleModel(), PeriodMother.CreateSimpleModel()));
        }
Beispiel #10
0
 public static EstimatedSaleCube CreateSimpleModel()
 {
     return(new EstimatedSaleCube(1000m, RegionMother.CreateSimpleTree(), PeriodMother.CreateSimpleTree()));
 }