Exemplo n.º 1
0
        public void UpdateVehicle_Should_Pass_If_Make_And_Model_Null_OR_Empty_AND_Year_Validation_Works(Vehicle testVehicle, string result)
        {
            _DataBaseContainer(db =>
            {
                // Arrange
                VehicleOperations vo = GetVehicleOperationsWithData(db, TestVehicles);

                // Act
                var _result = vo.UpdateVehicle(testVehicle);

                // Assert

                Assert.Equal(result, _result);
            });
        }
Exemplo n.º 2
0
        public void Should_Pass_If_Fails_To_Update_Non_Existing_Record()
        {
            _DataBaseContainer(db =>
            {
                // Arrange
                VehicleOperations vo = GetVehicleOperationsWithData(db, TestVehicles);
                var newVehicle       = new Vehicle
                {
                    Id    = TestVehicles.Count * 2,
                    Make  = "Porsche",
                    Model = "911 Turbo",
                    Year  = 2018
                };

                // Act
                var result = vo.UpdateVehicle(newVehicle);

                // Assert
                Assert.Equal("Failed to update vehicle!", result);

                Assert.Null(db.GetCollection <IVehicle>().Find(v => v.Make == newVehicle.Make && v.Model == newVehicle.Model && v.Id == newVehicle.Id).FirstOrDefault());
            });
        }
Exemplo n.º 3
0
        public void Should_Pass_If_Vehicle_Record_Is_Updated_Successfully()
        {
            _DataBaseContainer(db =>
            {
                // Arrange
                VehicleOperations vo = GetVehicleOperationsWithData(db, TestVehicles);
                var newVehicle       = new Vehicle
                {
                    Id    = 2,
                    Make  = "Porsche",
                    Model = "911 Turbo",
                    Year  = 2018
                };

                // Act
                var result = vo.UpdateVehicle(newVehicle);

                // Assert
                Assert.Contains("Success", result);

                Assert.NotNull(db.GetCollection <IVehicle>().Find(v => v.Make == newVehicle.Make && v.Model == newVehicle.Model && v.Id == newVehicle.Id).FirstOrDefault());
            });
        }