Exemplo n.º 1
0
        public Munro(
            int id,
            string name,
            decimal heightMeters,
            string gridRef,
            MunroType munroType)
        {
            // Let's go defensive
            if (id.Equals(0))
            {
                throw new ArgumentException("id must be greater than 0!");
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (heightMeters.Equals(0))
            {
                throw new ArgumentException("heightMeters must be greater than 0!");
            }
            if (string.IsNullOrWhiteSpace(gridRef))
            {
                throw new ArgumentNullException(nameof(gridRef));
            }

            Id           = id;
            Name         = name;
            HeightMeters = heightMeters;
            GridRef      = gridRef;
            MunroType    = munroType;
        }
        public void Return_Correct_MunroType(MunroType munroType)
        {
            // Arrange
            query.PageSize  = 100;
            query.MunroType = munroType;

            // Act
            var result = controller.Get(query);

            // Assert
            Assert.Equal(query.PageSize, result.Results.Where(x => x.MunroType.Equals(munroType)).Count());
        }
Exemplo n.º 3
0
        public void Assign_Parameters_On_Construction()
        {
            // Arrange
            const int       id           = 5;
            const string    name         = "Test";
            const decimal   heightMeters = 1.1m;
            const string    gridRef      = "1234567";
            const MunroType munroType    = MunroType.MUN;

            // Act
            var sut = new Munro(id, name, heightMeters, gridRef, munroType);

            // Assert
            Assert.Equal(id, sut.Id);
            Assert.Equal(name, sut.Name);
            Assert.Equal(heightMeters, sut.HeightMeters);
            Assert.Equal(gridRef, sut.GridRef);
            Assert.Equal(munroType, sut.MunroType);
        }