Esempio n. 1
0
        public void MessageShown()
        {
            var app2    = new StoryApplication("asdf", "content", StoryType.Joke);
            var result2 = new StoryCreator().CreateOrEditStory(app2);

            Assert.Contains("exists", result2.StoryApplication.Message);
        }
Esempio n. 2
0
        public VoteForAStoryTwice()
        {
            var sc     = new StoryCreator();
            var app    = new StoryApplication("Stick", "Whats brown and sticky? A stick", StoryType.Joke);
            var result = sc.CreateOrEditStory(app);

            _story = result.NewStory;
        }
        public ValidStoryApplicationReceived()
        {
            var storyCreator = new StoryCreator();
            var application  = new StoryApplication("Stick", "Whats brown and sticky? A stick", StoryType.Joke);

            _result = storyCreator.CreateOrEditStory(application);
            _story  = _result.NewStory;
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello world");

            // Connect to (localdb)\projects.HumourAzure and get all Stories
            var connectionString = @"server=(localdb)\projects;database=HumourAzure;Trusted_Connection=True;";

            using (var connection = new SqlConnection(connectionString)) {
                connection.Open();
                using (var command = new SqlCommand("SELECT StoryTypeID, Title, Content, VideoURL, ImageURL, AddedDate, Rating FROM Stories", connection)) {
                    using (var reader = command.ExecuteReader()) {
                        while (reader.Read())
                        {
                            var storyTypeID = reader["StoryTypeID"].ToString();
                            var title       = reader["Title"].ToString();
                            var content     = reader["Content"].ToString();
                            var videoURL    = reader["VideoURL"].ToString();
                            var imageURL    = reader["ImageURL"].ToString();
                            var addedDate   = Convert.ToDateTime(reader["AddedDate"]);
                            var rating      = Convert.ToInt32(reader["Rating"].ToString());

                            var storyType = StoryType.Joke;
                            if (storyTypeID == "1")
                            {
                                storyType = StoryType.Joke;
                            }
                            if (storyTypeID == "2")
                            {
                                storyType = StoryType.Video;
                            }

                            // Use API to insert into our system checking business rules
                            var sc = new StoryCreator();
                            var sa = new StoryApplication {
                                Content   = content,
                                ImageURL  = imageURL,
                                Rating    = rating,
                                StoryType = storyType,
                                Title     = title,
                                VideoURL  = videoURL,
                                CreatedAt = addedDate
                            };

                            var result = sc.CreateOrEditStory(sa);
                            if (result.StoryApplication.IsInvalid())
                            {
                                Console.WriteLine(result.StoryApplication.Title + ": " + result.StoryApplication.Message);
                            }
                        }
                    }
                }
            }
            Console.WriteLine("Finished");
            Console.ReadLine();
        }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        storyCreator = GameObject.Find("StoryCreator").GetComponent <StoryCreator>();

        animationList  = TSEiAResourceManager.LoadAnimation();
        operationPanel = gameObject.transform.GetChild(0);
        for (int i = 0; i < operationPanel.childCount - 2; i++)
        {
            operationPanel.GetChild(i).gameObject.GetComponent <Dropdown>().AddOptions(animationList);
        }
    }
Esempio n. 6
0
 public ActionResult Edit(StoryApplication app)
 {
     if (ModelState.IsValid)
     {
         // Call our StoryCreator service
         var sc = new StoryCreator();
         StoryCreatorResult result = sc.CreateOrEditStory(app);
         if (result.StoryApplication.IsValid())
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(app));
 }
Esempio n. 7
0
        public EditStoryReceived()
        {
            // Create a story
            _sc = new StoryCreator();
            var app = new StoryApplication("Stick", "Whats brown and sticky? A stick", StoryType.Joke);

            _result = _sc.CreateOrEditStory(app);

            // Edit that story using the id created above
            var _sc2 = new StoryCreator();
            var app2 = new StoryApplication("Stick", "Whats brown and sticky? A stick",
                                            StoryType.Joke, "", "", storyID: _result.NewStory.ID, rating: 5);
            var _result2 = _sc2.CreateOrEditStory(app2);

            _story2 = _result2.NewStory;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Factory!");

            IPrinter mainPrinter = new Printer();

            DocumentCreator cv         = new CVCreator();
            IDocument       cvInstance = cv.CreateDocument(mainPrinter);

            cvInstance.Print();

            DocumentCreator report         = new ReportCreator();
            IDocument       reportInstance = report.CreateDocument(mainPrinter);

            reportInstance.Print();

            DocumentCreator story         = new StoryCreator();
            IDocument       storyInstance = story.CreateDocument(mainPrinter);

            storyInstance.Print();
        }
Esempio n. 9
0
 void Start()
 {
     Instance = this;
     //DisplayCurrentStory(Color.white);
 }
Esempio n. 10
0
        public void StoryCreatorReturnsNewStoryTypeObject()
        {
            var result = new StoryCreator().CreateDocument(printerMock.Object);

            Assert.AreEqual(typeof(Story), result.GetType());
        }