Beispiel #1
0
        public void AddEmployees_ListWithNull_ThrowsExceptionWithInnerException()
        {
            var company   = new Company();
            var employee  = new WorkerA("Joni", 3000);
            var employees = new List <Employee>
            {
                employee,
                employee
            };

            Action act = () => company.AddEmployees(employees);

            act.Should().Throw <Exception>()
            .WithInnerException <Exception>();
        }
Beispiel #2
0
        public void AddEmployees_ListWithNull_ThrowsExceptionWithInnerNull()
        {
            var company   = new Company();
            var employees = new List <Employee>
            {
                new WorkerA("John", 4000),
                null,
                new WorkerA("John", 6000)
            };

            Action act = () => company.AddEmployees(employees);

            act.Should().Throw <Exception>()
            .WithInnerException <ArgumentNullException>();
        }
Beispiel #3
0
        public void GetHighestWage_ReturnsRighValue()
        {
            var company   = new Company();
            var expected  = 6000;
            var employees = new List <Employee>
            {
                new WorkerA("John", 4000),
                new WorkerA("John", 5000),
                new WorkerA("John", expected)
            };

            company.AddEmployees(employees);
            var actual = company.GetHighestWage();

            actual.Should().Be(expected);
        }
Beispiel #4
0
        public void GetByPosition_DeliveryManager_TwoElements()
        {
            var company   = new Company();
            var employees = new List <Employee>
            {
                new DeliveryManager("John", 4000),
                new WorkerA("John", 5000),
                new DeliveryManager("John", 20000)
            };

            company.AddEmployees(employees);

            var actual = company.GetByPosition(Position.DeliveryManager);

            actual.Should().HaveCount(2)
            .And.Contain(emp => emp.Position == Position.DeliveryManager);
        }
Beispiel #5
0
        public void GetByWage_LessThanMinimumWage_ReturnAllEmps()
        {
            var company  = new Company();
            var expected = new List <Employee>
            {
                new WorkerA("John", 4000),
                new WorkerA("John", 5000),
                new WorkerA("John", 6000)
            };

            company.AddEmployees(expected);

            var actual = company.GetByWage(1000);

            actual.Should().NotBeEmpty()
            .And.HaveCount(expected.Count)
            .And.BeEquivalentTo(expected);
        }
Beispiel #6
0
        public void GetByWage_BitGreaterThanMinimum_AllExceptOne()
        {
            var company   = new Company();
            var employees = new List <Employee>
            {
                new WorkerA("John", 4000),
                new WorkerA("John", 5000),
                new WorkerA("John", 6000)
            };

            company.AddEmployees(employees);
            var expectedCount = 2;

            var actual = company.GetByWage(4200);

            actual.Should().NotBeEmpty()
            .And.HaveCount(expectedCount)
            .And.NotContain(emp => emp.Wage < 4200);
        }