public void Add_FindById()
        {
            var repo = this.CreateRepo();
            var stub = _fixture.Create <Country>();

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                repo.Add(cn, stub);
            }

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                var stored = repo.FindById(cn, stub.id);
                stored.ShouldBeEquivalentTo(stub);
            }
        }
Exemple #2
0
        public void Add_FindById()
        {
            var repo = this.CreateRepo();
            var stub = _fixture.Create <Relative>();

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                repo.Add(cn, 123, stub);
            }

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                var stored = repo.FindAll(cn).First();
                stored.id = stub.id;
                stored.ShouldBeEquivalentTo(stub);
            }
        }
        public void Add3_Get3()
        {
            var repo = this.CreateRepo();

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                for (int i = 0; i < 3; i++)
                {
                    var stub = _fixture.Create <FriendsFollowersSubscriptions>();
                    repo.Add(cn, stub);
                }
            }

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                var stored = repo.FindAll(cn);
                stored.Should().HaveCount(3);
            }
        }
Exemple #4
0
        public void Add()
        {
            var repo    = Create();
            var userget = _fixture.Build <UserGet>()
                          .With(z => z.Friends, new List <UserGet>())
                          .With(z => z.Subscriptions, new List <UserGet>())
                          .With(z => z.Followers, new List <UserGet>())
                          .With(z => z.Groups, new List <GroupData>())
                          .Create();
            var id = userget.id;

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                repo.Add(cn, userget);
            }

            using (var cn = SqliteHelpers.CreateAndOpenConnection(connectionString))
            {
                var stored = repo.FindById(cn, userget.id);
                stored.ShouldBeEquivalentTo(userget);
            }
        }