예제 #1
0
        public void AssertPropertyValue_ProfileSaved_AllowsCheckingTheValueSet()
        {
            string   aString    = "aString";
            DateTime aDateTime  = 5.September(2011);
            TimeSpan anInterval = 4.Days();
            byte     enumB      = 1;

            new ProfileSubject("anyName")
            {
                AString       = aString,
                ANullableDate = aDateTime,
                AnEnum        = ACustomEnum.B,
                AnInterval    = anInterval
            }
            // important to save the values to the profile system
            .Save();

            ProfileTestProvider provider = (ProfileTestProvider)ProfileManager.Provider;

            provider
            .AssertPropertyValue(ProfileSubject.A_STRING, value => Assert.That(value, Is.EqualTo(aString)))
            .AssertPropertyValue(ProfileSubject.AN_ENUM, value => Assert.That(value, Is.EqualTo(enumB)))
            .AssertPropertyValue(ProfileSubject.A_NULLABLE_DATE, value => Assert.That(value, Is.EqualTo(aDateTime)))
            .AssertPropertyValue(ProfileSubject.AN_INTERVAL, value => Assert.That(value, Is.EqualTo(anInterval)));
        }
예제 #2
0
        public void AssertPropertyValue_UndefinedValue_NoException()
        {
            new ProfileSubject("anyName")
            {
                AString = "aString",
            }
            .Save();

            ProfileTestProvider provider = (ProfileTestProvider)ProfileManager.Provider;

            Assert.That(() => provider.AssertPropertyValue("notDefinedInConfiguration", _ => { }),
                        Throws.Nothing);
        }
예제 #3
0
        public void AssertPropertyValue_ProfileNotSaved_ProviderIsNotWareOfValue()
        {
            ProfileTestProvider provider = (ProfileTestProvider)ProfileManager.Provider;

            provider.StubValues(new { AString = "previous" });
            var subject = new ProfileSubject("anyName")
            {
                AString = "set"
            };

            // subject.Save();

            provider.AssertPropertyValue(ProfileSubject.A_STRING, value => Assert.That(value, Is.Not.EqualTo("set")));
        }
예제 #4
0
        public void AssertPropertyValue_HandlesNullProperties()
        {
            new ProfileSubject("anyName")
            {
                AString       = null,
                ANullableDate = null,
            }
            .Save();

            ProfileTestProvider provider = (ProfileTestProvider)ProfileManager.Provider;

            provider
            .AssertPropertyValue(ProfileSubject.A_STRING, value => Assert.That(value, Is.Null))
            .AssertPropertyValue(ProfileSubject.A_NULLABLE_DATE, value => Assert.That(value, Is.Null));
        }