Esempio n. 1
0
        public void PropertyChange_Should_HoldValidActions_WhenDouble()
        {
            var propertyChange = new PropertyChange <Product, double>(4.2, 2.1, x => x.Price);
            var product        = new Product("test");

            product.Price.Should().Be(0);

            propertyChange.GetRevertValueAction()(product);
            product.Price.Should().Be(propertyChange.PreviousValue);

            propertyChange.GetApplyValueAction()(product);
            product.Price.Should().Be(propertyChange.Value);
        }
Esempio n. 2
0
        public void PropertyChange_Should_HoldValidActions_WhenInt()
        {
            var propertyChange = new PropertyChange <Product, int>(2, 4, x => x.Available);
            var product        = new Product("test");

            Assert.Equal(0, product.Available);
            product.Available.Should().Be(0);

            propertyChange.GetRevertValueAction()(product);
            product.Available.Should().Be(propertyChange.PreviousValue);

            propertyChange.GetApplyValueAction()(product);
            product.Available.Should().Be(propertyChange.Value);
        }