Example #1
0
        public void FixtureForAddValidator_WhenDatePurchaseGreaterThanDateWarranty_ShouldHaveError()
        {
            // Arrange
            var model = new FixtureForAddDto()
            {
                DatePurchase = DateTime.Now.AddMinutes(-1),
                DateWarranty = DateTime.Now.AddHours(-1),
            };
            var sut = new FixtureForAddValidator();

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

            // Assert
            result.ShouldHaveValidationErrorFor(m => m.DateWarranty);
        }
Example #2
0
        public void FixtureForAddValidator_TrueStory()
        {
            // Arrange
            var model = new FixtureForAddDto()
            {
                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 FixtureForAddValidator();

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

            // Assert
            result.ShouldNotHaveAnyValidationErrors();
        }