public void NumberOfAllPackages_ReturnsNumberOfAllPackages()
        {
            var packages = new List <Package>
            {
                new Package {
                    Id = 1
                },
                new Package {
                    Id = 2
                },
                new Package {
                    Id = 3
                }
            };
            var mockContext = new Mock <InstantDeliveryContext>();

            mockContext.Setup(c => c.Packages).ReturnsDbSet(packages);
            mockContext.Setup(c => c.Employees).ReturnsDbSet(new List <Employee>());
            mockContext.Setup(c => c.Vehicles).ReturnsDbSet(new List <Vehicle>());

            var controller = new StatisticsController(mockContext.Object);

            var result = controller.General() as OkNegotiatedContentResult <GeneralStatisticsDto>;

            Assert.Equal(result?.Content.AllPackagesCount, 3);
        }
        public void General_NumberOfUsedVehicles()
        {
            var vehicles = new List <Vehicle>
            {
                new Vehicle {
                    Id = 1
                },
                new Vehicle {
                    Id = 2
                },
                new Vehicle {
                    Id = 3
                }
            };
            var employees = new List <Employee>
            {
                new Employee {
                    Id = 1, Vehicle = vehicles[0]
                },
                new Employee {
                    Id = 2, Vehicle = vehicles[1]
                }
            };
            var mockContext = new Mock <InstantDeliveryContext>();

            mockContext.Setup(c => c.Employees).ReturnsDbSet(employees);
            mockContext.Setup(c => c.Vehicles).ReturnsDbSet(vehicles);
            mockContext.Setup(c => c.Packages).ReturnsDbSet(new List <Package>());

            var controller = new StatisticsController(mockContext.Object);

            var result = controller.General() as OkNegotiatedContentResult <GeneralStatisticsDto>;

            Assert.Equal(result?.Content.UsedVehicles, 2);
        }
        public void General_UnassignedPackages()
        {
            var packages = new List <Package>
            {
                new Package {
                    Id = 1, Cost = 1
                },
                new Package {
                    Id = 2, Cost = 3
                }
            };
            var employees = new List <Employee>
            {
                new Employee {
                    Id = 1, Packages = new List <Package> {
                        packages.First()
                    }
                },
                new Employee {
                    Id = 2
                }
            };
            var mockContext = new Mock <InstantDeliveryContext>();

            mockContext.Setup(c => c.Employees).ReturnsDbSet(employees);
            mockContext.Setup(c => c.Vehicles).ReturnsDbSet(new List <Vehicle>());
            mockContext.Setup(c => c.Packages).ReturnsDbSet(packages);

            var controller = new StatisticsController(mockContext.Object);

            var result = controller.General() as OkNegotiatedContentResult <GeneralStatisticsDto>;

            Assert.Equal(result?.Content.UnassignedPackages, 1);
        }