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

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

            this.person.TelephoneNumber.Add(telephoneNumber);

            telephoneNumber.ValidatePoco();

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

            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());
        }