Esempio n. 1
0
        public void VerifyThatValidatePocoPropertiesAddsUserPreferenceError()
        {
            Assert.DoesNotThrowAsync(async() => await this.session.Object.Open());

            var userPreference = new UserPreference(Guid.NewGuid(), this.session.Object.Assembler.Cache, this.session.Object.Credentials.Uri);

            this.person.UserPreference.Add(userPreference);

            userPreference.ValidatePoco();

            this.session.Object.Assembler.Cache.TryAdd(new CacheKey(userPreference.Iid, null),
                                                       new Lazy <Thing>(() => userPreference));

            this.viewModel.BindPocoErrors();

            Assert.That(this.viewModel.Errors.Any(e => e.Error.Contains("The property Value is null or empty")));

            Assert.DoesNotThrow(() => this.viewModel.FixCommand.Execute(null));

            Assert.AreEqual(0, this.viewModel.Errors.Count(e => e.Error.Contains("The property Value is null or empty")));

            Assert.DoesNotThrowAsync(async() => await this.session.Object.Close());
        }