Esempio n. 1
0
        public void UpdatePostDoesntContainsTest()
        {
            IRepositoryPost repository = new SocialTrading.Service.Repositories.Repository(new RepositoryUserAuth(), new RepositoryUserSettings());

            var posts = new Dictionary <string, DataModelPost>
            {
                {
                    "123", new DataModelPost("123", "123", "123", "123", "123", 123.123f, "123", "123",
                                             "123", "123", "123", "123", "123", "123", 12, 123, true)
                }
            };

            repository.SetPosts(posts);

            repository.UpdatePost(new DataModelPost("00000", "123", "123", "123", "123", 123.123f, "123", "123",
                                                    "123", "123", "123", "123", "123", "123", 12, 123, true));

            CollectionAssert.AreEqual((Dictionary <string, DataModelPost>)repository.GetType().GetRuntimeFields().First(f => f.Name.Equals("_posts")).GetValue(repository), posts);
        }
Esempio n. 2
0
        public void UpdatePostContainsTest()
        {
            IRepositoryPost repository = new SocialTrading.Service.Repositories.Repository(new RepositoryUserAuth(), new RepositoryUserSettings());

            var posts = new Dictionary <string, DataModelPost>
            {
                {
                    "123", new DataModelPost("123", "123", "123", "123", "123", 123.123f, "123", "123",
                                             "123", "123", "123", "123", "123", "123", 12, 123, true)
                }
            };

            repository.SetPosts(posts);

            var expected = new DataModelPost("123", "123", "123", "123", "12121212121212121", 123.123f, "123", "123",
                                             "123", "123", "123", "123", "123", "123", 12, 123, true);

            repository.UpdatePost(expected);

            Assert.AreEqual(repository.GetPostBodyModelById("123"), expected);
        }