Ejemplo n.º 1
0
        public void Should_Create_Topic_And_Notify_The_User()
        {
            var PerofessionalDevelopment = new Topic
                {
                    ID = 3
                    ,
                    Color = ColorTranslator.FromHtml("#000000"),
                    Name = "Perofessional Development"
                };

            var formValue = new FormCollection();
            formValue.Add("ID", PerofessionalDevelopment.ID.ToString());
            formValue.Add("Name", PerofessionalDevelopment.Name);
            formValue.Add("Color", PerofessionalDevelopment.ColorInWebHex().Trim('#'));

            var controller = new TopicController();

            var result = (RedirectToRouteResult)controller.Create(formValue);

            Assert.Contains(PerofessionalDevelopment, TopicSource.Topics);
            Assert.AreEqual("Index", result.RouteValues["action"]);
            Assert.AreEqual("Your topic has been successfully.", controller.TempData["Message"]);
        }
Ejemplo n.º 2
0
 public void Sholud_Convert_Color_To_Hex_Value()
 {
     var aShadeOfRedTopic =
         new Topic {Color = Color.FromArgb(0, 208, 0, 0)};
     Assert.AreEqual("#D00000", aShadeOfRedTopic.ColorInWebHex());
 }