コード例 #1
0
        public PostareRepository()
        {
            _postari = new List <Models.Postare.Postare>();

            PostareFactory postareFactory = new PostareFactory();

            _postari.Add(postareFactory.CreeazaPostare("a", "a", "a", "a", (GradImportantaPostare)1,
                                                       (TipPostare)1, DateTime.Now));

            _postari.Add(postareFactory.CreeazaPostare("b", "b", "b", "b", (GradImportantaPostare)1,
                                                       (TipPostare)1, DateTime.Now));
        }
コード例 #2
0
        public void CreeazaPostareTestFail(int grad, int tip)
        {
            // Arrange
            var repo           = new PostareRepository();
            var PostareFactory = new PostareFactory();

            //Act
            var postare = PostareFactory.CreeazaPostare("1", "1", "1", "1", (GradImportantaPostare)grad,
                                                        (TipPostare)tip, DateTime.Now);
        }
コード例 #3
0
        public void AddPostToRepository(PostareViewModel pvm)
        {
            PostareFactory postareFactory = new PostareFactory();
            Postare        postare        = postareFactory.CreeazaPostare(pvm.Titlu, pvm.Autor, pvm.Body, pvm.Topic,
                                                                          pvm.NivelImportanta, pvm.Tip, DateTime.Now);

            repository.AdaugarePostare(postare);
            bus.Publish(new PostareImportantaCreata()
            {
                Titlu = postare.Titlu.Text,
                Body  = postare.Body.Text
            });
        }
コード例 #4
0
        public void CreeazaPostareTestPass()
        {
            // Arrange
            var repo           = new PostareRepository();
            var PostareFactory = new PostareFactory();
            var postare        = PostareFactory.CreeazaPostare("1", "1", "1", "1", (GradImportantaPostare)1,
                                                               (TipPostare)1, DateTime.Now);

            // Act
            repo.AdaugarePostare(postare);
            var result = repo.GetAllPosts();

            // Assert
            NUnit.Framework.Assert.Equals(3, result.Count);
        }