public void Should_Create_Topic_And_Notify_The_User() { var professionalDevelopment = new Topic { Id = 3, Color = ColorTranslator.FromHtml("#000000"), Name = "Professional Development" }; var formValues = new FormCollection(); formValues.Add("Id", professionalDevelopment.Id.ToString()); formValues.Add("Name",professionalDevelopment.Name); formValues.Add("Color", professionalDevelopment.ColorInWebHex().Trim('#')); var controller = new TopicController(); var result = (RedirectToRouteResult) controller.Create(formValues); Assert.Contains(professionalDevelopment, Topic.Topics); Assert.AreEqual("Index", result.RouteValues["action"]); Assert.AreEqual("Your topic has been added successfully.", controller.TempData["message"]); }
public void Should_Convert_Color_To_Hex_Value() { var aShadeOfRedTopic = new Topic {Color = Color.FromArgb(0, 208, 0, 0)}; Assert.AreEqual("#D00000",aShadeOfRedTopic.ColorInWebHex()); }