コード例 #1
0
        public void CanGetPersonById()
        {
            using (var dbsProvider = new TestDBsProvider()) {
                this.AddThreePersons(dbsProvider);

                using (var w = new RegistersWrapper(dbsProvider)) {
                    var rdbc = w.DB.Tables.DbContextForReader;

                    Assert.True(rdbc.People.Where(
                                    p => p.Id == Id2 &&
                                    p.Name == Name2 && p.Surname == Surname2
                                    ).Count() == 1
                                );

                    IPeopleRegister register  = w.New.PeopleRegister();
                    var             regReader = (IPeopleRegisterReader)register;

                    foreach (PersonRow person in new[] {
                        register.GetById(Id2),
                        regReader.GetById(Id2)
                    }
                             )
                    {
                        Assert.True(person.Id == Id2 &&
                                    person.Name == Name2 &&
                                    person.Surname == Surname2);
                    }
                }
            }
        }
コード例 #2
0
        public void CanTryToLookupPeopleWhenEmpty()
        {
            using (var w = new RegistersWrapper()) {
                IPeopleRegister rwRegister = w.New.PeopleRegister();
                var             roRegister = (IPeopleRegisterReader)rwRegister;

                Assert.True(roRegister.GetById("123") == null);
                Assert.True(roRegister.All
                            .Count(p => p.Id == "123") == 0);

                Assert.True(rwRegister.GetById("123") == null);
                Assert.True(rwRegister.All
                            .Count(p => p.Id == "123") == 0);
            }
        }