Example #1
0
        public void FixtureForUpdateValidator_WhenPriceLessThanOne_ShouldHaveError()
        {
            // Arrange
            var model = new FixtureForUpdateDto()
            {
                Price = 0.8M,
            };
            var sut = new FixtureForUpdateValidator();

            // Act
            var result = sut.TestValidate(model);

            // Assert
            result.ShouldHaveValidationErrorFor(m => m.Price);
        }
Example #2
0
        public void FixtureForUpdateValidator_TrueStory()
        {
            // Arrange
            var model = new FixtureForUpdateDto()
            {
                Id           = Guid.NewGuid(),
                CategoryId   = 1,
                DatePurchase = DateTime.Now.AddMinutes(-2),
                DateWarranty = DateTime.Now.AddYears(2),
                Description  = "Desc Fixture T",
                Name         = "Fixture T",
                PictureUrl   = "picture.lk",
                Price        = 10000M,
                SupplierId   = 1
            };
            var sut = new FixtureForUpdateValidator();

            // Act
            var result = sut.TestValidate(model);

            // Assert
            result.ShouldNotHaveAnyValidationErrors();
        }