public async Task GetMotorilId_WithExistentId_ShouldReturnCorrectResult()
        {
            string errorMessagePrefix = "MotorOilService GetMotorOilById() method does not work properly.";

            var context = SntDbContextInMemoryFactory.InitializeContext();

            await SeedData(context);

            this.motorOilService = new MotorOilService(context);

            MotorOilServiceModel expectedData = context.MotorOils.First().To <MotorOilServiceModel>();
            MotorOilServiceModel actualData   = this.motorOilService.GetMotorOilById(expectedData.Id);

            Assert.True(expectedData.Model == actualData.Model, errorMessagePrefix + " " + "Model is not returned properly.");
            Assert.True(expectedData.Brand == actualData.Brand, errorMessagePrefix + " " + "Brand is not returned properly.");
            Assert.True(expectedData.Viscosity == actualData.Viscosity, errorMessagePrefix + " " + "Viscosity is not returned properly.");
            Assert.True(expectedData.Status == actualData.Status, errorMessagePrefix + " " + "Status is not returned properly.");
            Assert.True(expectedData.Volume == actualData.Volume, errorMessagePrefix + " " + "Volume is not returned properly.");
            Assert.True(expectedData.Type == actualData.Type, errorMessagePrefix + " " + "Type is not returned properly.");
            Assert.True(expectedData.Description == actualData.Description, errorMessagePrefix + " " + "Description is not returned properly.");
            Assert.True(expectedData.Price == actualData.Price, errorMessagePrefix + " " + "Price is not returned properly.");
            Assert.True(expectedData.Picture == actualData.Picture, errorMessagePrefix + " " + "Picture is not returned properly.");
        }
예제 #2
0
 public MotorOilController(IMotorOilService motorOilService, ICloudinaryService cloudinaryService)
 {
     this.motorOilService   = motorOilService;
     this.cloudinaryService = cloudinaryService;
 }