Ejemplo n.º 1
0
        public void GetAllPostsReturnsPostsInAscendingChronologicalOrder()
        {
            var testDB = new TestingDatabase();
            var posts  = new List <Post>
            {
                new Post("user1", "message1"),
                new Post("user2", "message2"),
                new Post("user3", "message3"),
                new Post("user4", "message4"),
                new Post("user5", "message5")
            };

            posts.Reverse();

            //Just checking that the posts are in fact in descending chronological order
            posts.Select(p => p.Timestamp).Should().BeInDescendingOrder();

            testDB.Posts.AddRange(posts);

            var bbs    = new BBService(testDB);
            var result = bbs.GetAllPosts();

            result.Should().HaveCount(5);
            result.Select(p => p.Timestamp).Should().BeInAscendingOrder();
        }
Ejemplo n.º 2
0
        public void PostingSavesToTheDatabase()
        {
            var testDB = new TestingDatabase();

            var bbs = new BBService(testDB);

            bbs.Post("a_user", "a_message");

            testDB.Posts.Should().HaveCount(1);
            testDB.Posts[0].UserName.Should().Be("a_user");
            testDB.Posts[0].Message.Should().Be("a_message");
        }
Ejemplo n.º 3
0
        public void WriteCRMDetails(CRMStage currentStage, UserProfile profile)
        {
            CheckEnabled();
            if (!IsActive)
            {
                return;
            }

            switch (currentStage)
            {
            case CRMStage.New:
                break;

            case CRMStage.BasicDetails:
                //ZohoService.CreateUpdateLead(profile);
                break;

            case CRMStage.FinancingCompleted:
                BBService.CreateUpdateLead(profile);
                ZohoService.CreateUpdateLead(profile);
                ZohoService.WriteFinancingNote(profile);
                break;

            case CRMStage.VehicleProfileCompleted:
                BBService.CreateUpdateLead(profile);
                ZohoService.CreateUpdateLead(profile);
                ZohoService.WriteVehicleProfileNote(profile);
                break;

            case CRMStage.ValueTradeInCompleted:
                BBService.CreateUpdateLead(profile);
                ZohoService.CreateUpdateLead(profile);
                ZohoService.WriteTradeInNote(profile);
                break;

            case CRMStage.SimpleInventoryCompleted:
                BBService.CreateUpdateLead(profile);
                ZohoService.CreateUpdateLead(profile);
                ZohoService.WriteInventoryNote(profile);
                break;
            }
        }
Ejemplo n.º 4
0
        public void CanGetAllPosts()
        {
            var testDB = new TestingDatabase();

            testDB.Posts.Add(new Post("user1", "message1"));
            testDB.Posts.Add(new Post("user2", "message2"));
            testDB.Posts.Add(new Post("user3", "message3"));
            testDB.Posts.Add(new Post("user4", "message4"));
            testDB.Posts.Add(new Post("user5", "message5"));

            var bbs    = new BBService(testDB);
            var result = bbs.GetAllPosts();

            result.Should().HaveCount(5);
            result.Select(p => p.UserName).Should()
            .BeEquivalentTo(new List <string>
            {
                "user1",
                "user2",
                "user3",
                "user4",
                "user5"
            });
        }
Ejemplo n.º 5
0
        public void WhenDatabaseIsEmptyGetAllPostsIsEmpty()
        {
            var bbs = new BBService(new TestingDatabase());

            bbs.GetAllPosts().Should().BeEmpty();
        }