Exemple #1
0
        public void CanVerifyPropertyWithoutValue()
        {
            var toTest = new Properties();
            var error  = new PropertyCase(toTest)
            {
                p => p.String == "foobar"
            }.Run();

            Assert.Equal("foobar", error.ExpectedValue);
            Assert.Null(error.ActualValue);
            Assert.Equal(nameof(Properties.String), error.Target);
        }
Exemple #2
0
        public void CanVerifyMultipleProperties()
        {
            var toTest = new Properties
            {
                String = "foo",
                Long   = 42
            };
            var error = new PropertyCase(toTest)
            {
                p => p.String == "foo",
                p => p.Long == 41
            }.Run();

            Assert.Equal(41L, error.ExpectedValue);
            Assert.Equal(42L, error.ActualValue);
            Assert.Equal(nameof(Properties.Long), error.Target);
        }
Exemple #3
0
        public void CanVerifyFailViaObject()
        {
            var toTest = new Properties
            {
                String = "foo"
            };
            var error = new PropertyCase(toTest)
            {
                () => new Properties
                {
                    String = "fooBar"
                }
            }.Run();

            Assert.Equal("fooBar", error.ExpectedValue);
            Assert.Equal("foo", error.ActualValue);
            Assert.Equal(nameof(Properties.String), error.Target);
        }
Exemple #4
0
        public void CanVerifyMultiplePropertiesWithoutFailing()
        {
            var now    = DateTime.Now;
            var toTest = new Properties
            {
                String   = "foo",
                Long     = 42,
                Boolean  = true,
                DateTime = now
            };
            var error = new PropertyCase(toTest)
            {
                p => p.String == "foo",
                p => p.Long == 42,
                p => p.Boolean == true,
                p => p.DateTime == now
            }.Run();

            Assert.Null(error);
        }