Ejemplo n.º 1
0
        public static void CreateServer()
        {
            Console.WriteLine("RDJTP server is starting.");
            var server = new TcpListener(IPAddress.Loopback, 5000);

            server.Start();
            InMemoryDb db = new InMemoryDb();

            try
            {
                while (true)
                {
                    Console.WriteLine("Server started. Waiting for a connection...");
                    var client      = server.AcceptTcpClient();
                    var clientSetup = new ClientSetup(db);
                    Console.WriteLine("Connected.");

                    // Read more here: https://codinginfinite.com/multi-threaded-tcp-server-core-example-csharp/

                    var thread = new Thread(new ParameterizedThreadStart(clientSetup.HandleClientRequests));
                    thread.Start(client);
                }
            }
            catch (SocketException e)
            {
                Console.WriteLine($"CreateServer failed with error: {e.Message}");
                server.Stop();
            }
        }
Ejemplo n.º 2
0
        private async void GetAll()
        {
            SearchVm <SampleFrameM> actual;

            using (var context = InMemoryDb.CreateDbContext())
            {
                context.Initialize();
                var userId = (await context.Users.FirstOrDefaultAsync()).Id;
                context.SampleFrames.AddRange(
                    new SampleFrame
                {
                    Fields    = JsonConvert.SerializeObject(new[] { FieldEnum.Name, FieldEnum.ShortName }),
                    Name      = "1",
                    UserId    = userId,
                    Predicate = JsonConvert.SerializeObject(CreateExpressionGroup()),
                },
                    new SampleFrame
                {
                    Fields = JsonConvert.SerializeObject(new[]
                                                         { FieldEnum.StatId, FieldEnum.Name, FieldEnum.ShortName }),
                    Name      = "2",
                    UserId    = userId,
                    Predicate = JsonConvert.SerializeObject(CreateExpressionGroup()),
                });
                await context.SaveChangesAsync();

                actual = await new SampleFramesService(context, null).GetAll(new SearchQueryM {
                    Page = 1, PageSize = 1
                }, (await context.Users.FirstAsync()).Id);
            }

            Assert.Single(actual.Result);
            Assert.Equal(2, actual.TotalCount);
        }
Ejemplo n.º 3
0
        private async void GetById()
        {
            SampleFrameM actual;
            var          expectedFields    = new[] { FieldEnum.StatId, FieldEnum.Name };
            var          expectedPredicate = CreateExpressionGroup();
            var          expected          = new SampleFrame
            {
                Fields      = JsonConvert.SerializeObject(expectedFields),
                Name        = "test",
                Description = "SF test",
                Predicate   = JsonConvert.SerializeObject(expectedPredicate),
                User        = new User {
                    UserName = "******"
                }
            };

            using (var context = InMemoryDb.CreateDbContext())
            {
                context.SampleFrames.Add(expected);
                await context.SaveChangesAsync();

                actual = await new SampleFramesService(context, null).GetById(expected.Id, (await context.Users.FirstOrDefaultAsync()).Id);
            }

            Assert.Equal(expected.Name, actual.Name);
            Assert.Equal(expected.Description, actual.Description);
            Assert.Equal(expectedFields[0], actual.Fields.First());
            Assert.Equal(expectedFields[1], actual.Fields.Last());
            Assert.Equal(expectedPredicate.Groups.Count(), actual.Predicate.Groups.Count());
        }
        public void Update_Returns_True_And_Modifies_Existing()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);

            List <Person> people = CreateRandomList();

            repo.Add(people);

            // Create a new 'detached' person.
            //
            Person person1Updated = new Person
            {
                FirstName = Guid.NewGuid().ToString(),
                LastName  = Guid.NewGuid().ToString()
            };
            PrivateKeySetter privateKeySetter = new PrivateKeySetter();

            privateKeySetter.SetKey(person1Updated, people[0].Id);


            Assert.IsTrue(repo.Update(person1Updated));
            Assert.AreNotEqual(person1Updated, people[0]);
            Assert.IsTrue(repo.Count() == people.Count);
        }
Ejemplo n.º 5
0
        public async Task GetAsync_Id_ReturnsOrganization(
            OrganizationEntity organizationEntity,
            List <OrganizationEntity> list,
            Organization organization,
            Mock <IMapper <OrganizationMember, OrganizationMemberEntity> > mapMember,
            Mock <IMapper <Organization, OrganizationEntity> > entityMapper)
        {
            // Arrange
            list.Add(organizationEntity);
            var mapDomain = new Mock <IMapper <OrganizationEntity, Organization> >();

            mapDomain.Setup(x => x.Map(organizationEntity)).Returns(mapDomain.Object);
            mapDomain.Setup(x => x.ToOutFormat()).Returns(organization);
            var db      = new InMemoryDb <OrganizationDbContext>();
            var context = new OrganizationDbContext(db.GetOptions());
            var repo    = new ReadWriteOrganizationRepository(context, entityMapper.Object, mapDomain.Object, mapMember.Object);

            context.Organizations.AddRange(list);
            context.SaveChanges();

            // Act
            var Actual = await repo.GetAsync(organizationEntity.Id);

            // Arrange
            Actual.Should().BeOfType <Organization>();
        }
        public void Delete_Returns_False_If_Does_Not_Exist_And_Does_Not_Modify_List()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);

            List <Person> people = CreateRandomList();

            repo.Add(people);


            // Create a new 'detached' person that does not exist.
            //
            Person doesNotExist = new Person
            {
                FirstName = Guid.NewGuid().ToString(),
                LastName  = Guid.NewGuid().ToString()
            };
            PrivateKeySetter privateKeySetter = new PrivateKeySetter();

            privateKeySetter.SetKey(doesNotExist, 100);

            Assert.IsFalse(repo.Delete(doesNotExist));
            Assert.IsTrue(repo.Count() == people.Count);
            foreach (Person person in people)
            {
                Assert.AreEqual(person, people[person.Id]);
            }
        }
Ejemplo n.º 7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            InMemoryDb.Init();

            services.AddSingleton <IProjectRepository, ProjectRepository>();
            services.AddSingleton <IProjectService, ProjectService>();
            services.AddSingleton <ITeamRepository, TeamRepository>();
            services.AddSingleton <ITeamService, TeamService>();
            services.AddSingleton <IUserRepository, UserRepository>();
            services.AddSingleton <IUserService, UserService>();
            services.AddSingleton <ISpecialityRepository, SpecialityRepository>();
            services.AddSingleton <ISpecialtyService, SpecialtyService>();
            services.AddSingleton <ISprintRepository, SprintRepository>();
            services.AddSingleton <ISprintService, SprintService>();
            services.AddSingleton <ILectorRepository, LectorRepository>();
            services.AddSingleton <ILectorService, LectorService>();
            services.AddSingleton <IFacultyRepository, FacultyRepository>();
            services.AddSingleton <IFacultyService, FacultyService>();
            services.AddSingleton <IStoryRepository, StoryRepository>();
            services.AddSingleton <IStoryService, StoryService>();

            services.AddAutoMapper(typeof(Startup));
            //services.AddAutoMapper(x =>
            //{
            //    x.CreateMap
            //});

            services.AddSingleton(Log.Logger);

            services.AddControllers();
            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerGen();
        }
        public async Task GetUserOrganizationByEmail_ReturnsDomainList(List <OrganizationEntity> organizations, OrganizationMemberEntity memberEntity, Organization organization)
        {
            var orgMembers = new List <OrganizationMemberEntity>();

            // Arrange
            organizations.ForEach(x =>
                                  orgMembers.Add(
                                      new OrganizationMemberEntity
            {
                OrganizationId = x.Id,
                Organization   = x,
                Email          = memberEntity.Email,
                Permission     = memberEntity.Permission,
                UserName       = memberEntity.UserName
            }));

            var mapDomain = new Mock <IMapper <OrganizationEntity, Organization> >();

            mapDomain.Setup(x => x.Map(It.IsAny <OrganizationEntity>())).Returns(mapDomain.Object);
            mapDomain.Setup(x => x.ToOutFormat()).Returns(organization);
            var mapMemberDomain = new Mock <IMapper <OrganizationMemberEntity, OrganizationMember> >();

            mapMemberDomain.Setup(x => x.Map(It.IsAny <OrganizationMemberEntity>())).Returns(mapMemberDomain.Object);
            var db      = new InMemoryDb <OrganizationDbContext>();
            var context = new OrganizationDbContext(db.GetOptions());
            var repo    = new ReadOnlyOrganizationMemberRepository(context, mapMemberDomain.Object, mapDomain.Object);

            context.OrganizationMembers.AddRange(orgMembers);
            context.SaveChanges();
            // Act
            var hest = await repo.GetUserOrganizationsByEmail(memberEntity.Email);

            // Arrange
            hest.Should().HaveCount(3);
        }
        public InMemoryTicTacToeRepositoryTests() : base()
        {
            var inMemoryDb = new InMemoryDb();

            _gameRepository      = new InMemoryGameRepository(inMemoryDb);
            _ticTacToeRepository = new InMemoryTicTacToeRepository(inMemoryDb);
        }
Ejemplo n.º 10
0
        public async Task AddOrganization_Success(
            Organization organization,
            OrganizationMemberEntity memb,
            Mock <IMapper <OrganizationMemberEntity, OrganizationMember> > orgMemberDomainMapper
            )

        {
            // Arrange
            var mapMember = new Mock <IMapper <OrganizationMember, OrganizationMemberEntity> >();

            mapMember.Setup(x => x.Map(It.IsAny <OrganizationMember>())).Returns(mapMember.Object);
            mapMember.Setup(x => x.ToOutFormat()).Returns(memb);
            var mapDomain    = new OrganizationDomainMapper(orgMemberDomainMapper.Object);
            var entityMapper = new OrganizationEntityMapper(mapMember.Object);
            var db           = new InMemoryDb <OrganizationDbContext>();
            var context      = new OrganizationDbContext(db.GetOptions());
            var repo         = new ReadWriteOrganizationRepository(context, entityMapper, mapDomain, mapMember.Object);

            // Act

            await repo.AddOrganization(organization);

            var actual = await context.Organizations.FindAsync(organization.Id.Id);

            // Assert
            actual.Id.Should().Be(organization.Id.Id);
            organization.Address.Should().BeEquivalentTo(actual, options => options.ExcludingMissingMembers());
        }
Ejemplo n.º 11
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            InMemoryDb.Init();

            services.AddControllers();

            services.AddSingleton <IVehicleRepository, VehicleRepository>();
            services.AddSingleton <IRVRepository, RVRepository>();
            services.AddSingleton <ISUVRepository, SUVRepository>();

            services.AddSingleton <IVehicleService, VehicleService>();
            services.AddSingleton <IRVService, RVService>();
            services.AddSingleton <ISUVService, SUVService>();

            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc("v1",
                                   new Microsoft.OpenApi.Models.OpenApiInfo
                {
                    Title       = "LastTask",
                    Description = "Cars",
                    Version     = "v1"
                });
            });

            services.AddHealthChecks();

            services.AddAutoMapper(typeof(Startup));
        }
        public void GetTable_ReturnsExistingTable()
        {
            InMemoryDb db = new InMemoryDb();

            Assert.IsTrue(db.TableCount() == 0);

            InMemoryDbTable <int, Person> people = db.GetTable <int, Person>();

            Assert.IsNotNull(people);
            Assert.IsTrue(people.Count() == 0);
            Assert.IsTrue(db.TableCount() == 1);

            InMemoryDbTable <int, Address> address = db.GetTable <int, Address>();

            Assert.IsNotNull(address);
            Assert.IsTrue(db.TableCount() == 2);

            Person person = new Person {
                FirstName = "first name", LastName = "last name"
            };

            people.Add(person);
            Assert.IsTrue(people.Count() == 1);

            InMemoryDbTable <int, Person> peopleCopy = db.GetTable <int, Person>();

            Assert.IsNotNull(peopleCopy);
            Assert.IsTrue(peopleCopy.Count() == 1);
        }
Ejemplo n.º 13
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public virtual void ConfigureServices(IServiceCollection services)
        {
            InMemoryDb.Init();

            var jwtSettings = new JwtSettings();

            Configuration.Bind(nameof(jwtSettings), jwtSettings);
            services.AddSingleton(jwtSettings);

            services.Configure <MongoDbConfiguration>(Configuration.GetSection(nameof(MongoDbConfiguration)));

            var mongoSettings = Configuration.GetSection(nameof(MongoDbConfiguration)).Get <MongoDbConfiguration>();

            services.AddScoped <IIdentityService, IdentityService>();

            services.AddIdentity <ApplicationUser, ApplicationRole>()
            .AddMongoDbStores <ApplicationUser, ApplicationRole, Guid>(mongoSettings.ConnectionString, mongoSettings.DatabaseName)
            .AddSignInManager()
            .AddDefaultTokenProviders();

            services.AddHealthChecks();
            services.AddUoWServices();
            services.AddUoWRepositories();

            services.AddAutoMapper(typeof(Startup));

            services.AddSingleton(Log.Logger);

            services.AddAuthentication(op =>
            {
                op.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                op.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                op.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(x =>
            {
                x.SaveToken = true;
                x.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(jwtSettings.Secret)),
                    ValidateIssuer           = false,
                    RequireExpirationTime    = false,
                    ValidateLifetime         = true,
                    ValidateAudience         = false
                };
            });

            services.AddAuthorization(options =>
            {
                options.AddPolicy("ViewUserPositions", p => p.RequireAuthenticatedUser().RequireClaim("View"));
            });


            services.AddControllers().AddFluentValidation(fv => fv.RegisterValidatorsFromAssemblyContaining <Startup>());

            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerConfiguration();
        }
        public void Create_Returns_Db_Session()
        {
            InMemoryDb db = new InMemoryDb();
            DbSessionFactory dbSessionFactory = new DbSessionFactory(db);

            IDbSession dbSession = dbSessionFactory.Create();
            Assert.IsNotNull(dbSession);
        }
        private static DbSession GetSession()
        {
            InMemoryDb db = new InMemoryDb();

            DbSession dbSession = new DbSession(db);

            return(dbSession);
        }
Ejemplo n.º 16
0
 public DbSessionFactory(InMemoryDb db)
 {
     if(db==null)
     {
         throw new ArgumentNullException("db");
     }
     _db = db;
 }
        public void Create_Returns_Db_Session()
        {
            InMemoryDb       db = new InMemoryDb();
            DbSessionFactory dbSessionFactory = new DbSessionFactory(db);

            IDbSession dbSession = dbSessionFactory.Create();

            Assert.IsNotNull(dbSession);
        }
        public void Create_Throws_If_Key_Type_Not_Supported()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <DateTime, DateTimeKey> table = db.GetTable <DateTime, DateTimeKey>();
            Repository <DateTime, DateTimeKey>      repo  = new Repository <DateTime, DateTimeKey>(table);

            DateTimeKey entity = new DateTimeKey();

            // create
            repo.Add(entity);
        }
Ejemplo n.º 19
0
        public IHttpActionResult PostMultiply(Operation operation)
        {
            var result          = operation.Number1 * operation.Number2;
            var operationResult = new OperationResult {
                Operation = operation, Result = result, Operator = "*"
            };

            InMemoryDb.Add(operationResult);

            return(Ok(operationResult.Result));
        }
Ejemplo n.º 20
0
        public IHttpActionResult PostSubstract(Operation operation)
        {
            var result          = operation.Number1 - operation.Number2;
            var operationResult = new OperationResult {
                Operation = operation, Result = result, Operator = "-"
            };

            InMemoryDb.Add(operationResult);

            return(Ok(operationResult.Result));
        }
        public void Delete_Returns_True_And_Removes_A_List_Of_Entities_If_Found()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);

            List <Person> people = CreateRandomList();

            repo.Add(people);

            Assert.IsTrue(repo.Delete(people));
            Assert.IsTrue(repo.Count() == 0);
        }
        public void Create_Adds_A_List_Of_Entities_To_The_Table()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);
            List <Person> people = CreateRandomList();

            // create
            Assert.IsTrue(repo.Add(people));
            Assert.IsTrue(table.Count() == people.Count);
            Assert.IsTrue(repo.Count() == people.Count);
            Assert.IsTrue(repo.All().Count() == people.Count);
        }
        public void Create_Adds_Entity_To_The_Table_And_Sets_String_Key()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <string, StringKey> table = db.GetTable <string, StringKey>();
            Repository <string, StringKey>      repo  = new Repository <string, StringKey>(table);

            StringKey entity = new StringKey();

            // create
            Assert.IsTrue(repo.Add(entity));
            Assert.IsTrue(table.Count() == 1);
            Assert.IsTrue(entity.Id != null);
        }
        public void Create_Adds_Entity_To_The_Table_And_Sets_Guid_Key()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <Guid, GuidKey> table = db.GetTable <Guid, GuidKey>();
            Repository <Guid, GuidKey>      repo  = new Repository <Guid, GuidKey>(table);

            GuidKey entity = new GuidKey();

            // create
            Assert.IsTrue(repo.Add(entity));
            Assert.IsTrue(table.Count() == 1);
            Assert.IsTrue(entity.Id != Guid.Empty);
        }
        public void Read_Returns_Null_If_Id_Does_Not_Exist()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);

            List <Person> people = CreateRandomList();

            repo.Add(people);

            Person shouldBeNull = repo.FindBy(100);

            Assert.IsNull(shouldBeNull);
        }
Ejemplo n.º 26
0
        public void GetTable_CreatesNewTables()
        {
            InMemoryDb db = new InMemoryDb();

            Assert.IsTrue(db.TableCount() == 0);

            InMemoryDbTable<int, Person> people = db.GetTable<int, Person>();
            Assert.IsNotNull(people);
            Assert.IsTrue(db.TableCount() == 1);

            InMemoryDbTable<int, Address> addresses = db.GetTable<int, Address>();
            Assert.IsNotNull(addresses);
            Assert.IsTrue(db.TableCount() == 2);
        }
Ejemplo n.º 27
0
        public void GetAll()
        {
            using (var scope = Factory.Services.CreateScope())
            {
                var countryMock = new Mock <ICountryService>();
                countryMock.Setup(x => x.GetAll()).Returns(InMemoryDb.OnlyCountries);
                var logger            = scope.ServiceProvider.GetRequiredService <ILogger <CountryController> >();
                var countryController = new CountryController(logger, countryMock.Object);

                var result = countryController.GetAll();

                var model = Assert.IsAssignableFrom <IEnumerable <Country> >(result);
                Assert.Equal(InMemoryDb.OnlyCountries().Count, model.Count());
            }
        }
Ejemplo n.º 28
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().AddNewtonsoftJson();
            services.AddResponseCompression(opts =>
            {
                opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
                    new[] { "application/octet-stream" });
            });

            var inMemoryDb = new InMemoryDb();

            services.AddSingleton(inMemoryDb);

            services.AddSignalR();
            services.AddTransient <HubConnectionBuilder>();
        }
        public void GetTable_CreatesNewTables()
        {
            InMemoryDb db = new InMemoryDb();

            Assert.IsTrue(db.TableCount() == 0);

            InMemoryDbTable <int, Person> people = db.GetTable <int, Person>();

            Assert.IsNotNull(people);
            Assert.IsTrue(db.TableCount() == 1);

            InMemoryDbTable <int, Address> addresses = db.GetTable <int, Address>();

            Assert.IsNotNull(addresses);
            Assert.IsTrue(db.TableCount() == 2);
        }
        public void Read_Finds_Exising()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);

            List <Person> people = CreateRandomList();

            repo.Add(people);

            foreach (Person person in people)
            {
                Person copy = repo.FindBy(person.Id);
                Assert.IsNotNull(copy);
                Assert.AreEqual(copy, person);
            }
        }
Ejemplo n.º 31
0
        public void GetAsync_badId_ThrowsException(List <OrganizationEntity> list, OrganizationEntity organizationEntity)
        {
            // Arrange
            var mapDomain = new Mock <IMapper <OrganizationEntity, Organization> >();

            var db      = new InMemoryDb <OrganizationDbContext>();
            var context = new OrganizationDbContext(db.GetOptions());
            var repo    = new ReadOnlyOrganizationRepository(context, mapDomain.Object);

            context.Organizations.AddRange(list);
            context.SaveChanges();

            // Act
            Func <Task> act = async() => await repo.GetAsync(organizationEntity.Id);

            // Arrange
            act.Should().Throw <EntityNotFoundException>();
        }
        public void Create_Adds_Entities_To_The_Table_And_Sets_Int_Key()
        {
            InMemoryDb db = new InMemoryDb();
            InMemoryDbTable <int, Person> table = db.GetTable <int, Person>();
            Repository <int, Person>      repo  = new Repository <int, Person>(table);
            List <Person> people = CreateRandomList();

            // create
            int expectedCount = 0;

            foreach (Person person in people)
            {
                Assert.IsTrue(table.Count() == expectedCount++);
                Assert.IsTrue(repo.Add(person));
                Assert.IsTrue(table.Count() == expectedCount);
                Assert.IsTrue(person.Id == expectedCount - 1);
            }
        }
Ejemplo n.º 33
0
        public static void Main(string[] args)
        {
            IHost host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services   = scope.ServiceProvider;
                var context    = services.GetRequiredService <HomeWorkDbContext>();
                var inMemoryDb = new InMemoryDb();

                // context.Seat.AddRange(inMemoryDb.Performances.SelectMany(s=>s.Seats).Distinct());
                // context.Reservation.AddRange(inMemoryDb.Performances.SelectMany(s => s.Seats).SelectMany(s => s.Reservations).Distinct());
                context.Performance.AddRange(inMemoryDb.Performances);
                context.User.AddRange(inMemoryDb.Users);
                context.SaveChanges();
            }
            host.Run();
        }
Ejemplo n.º 34
0
        public void GetTable_ReturnsExistingTable()
        {
            InMemoryDb db = new InMemoryDb();

            Assert.IsTrue(db.TableCount() == 0);

            InMemoryDbTable<int, Person> people = db.GetTable<int, Person>();
            Assert.IsNotNull(people);
            Assert.IsTrue(people.Count() == 0);
            Assert.IsTrue(db.TableCount() == 1);

            InMemoryDbTable<int, Address> address = db.GetTable<int, Address>();
            Assert.IsNotNull(address);
            Assert.IsTrue(db.TableCount() == 2);

            Person person = new Person {FirstName = "first name", LastName = "last name"};
            people.Add(person);
            Assert.IsTrue(people.Count() == 1);

            InMemoryDbTable<int, Person> peopleCopy = db.GetTable<int, Person>();
            Assert.IsNotNull(peopleCopy);
            Assert.IsTrue(peopleCopy.Count() == 1);
        }