public void AddSendsMessage()
        {
            var message = new CreateGoalMessage();
            _messageCreatorMock.Setup(p => p.Create<CreateGoalMessage>()).Returns(message);
            var addGoalModel = new AddGoalModel { Name = StringsForTest.RandomString(), Description = StringsForTest.RandomString() };
            _instanceUnderTest.Add(addGoalModel);

            _busMock.Verify(p => p.Send("MyPathX.Services.GoalManagement", message));
        }
예제 #2
0
        //public ActionResult Add(AddGoalModel model)
        //{
        //    var command = MessageCreator.Create<CreateGoalMessage>();
        //    command.Name = model.Name;
        //    command.Description = model.Description;
        //    Bus.Send("MyPathX.Services.GoalManagement", command);
        //    return RedirectToAction("index", "home");
        //}
        public JsonResult Add(AddGoalModel model)
        {
            var command = MessageCreator.Create<CreateGoalMessage>();
            command.Name = model.Name;
            command.Description = model.Description;
            command.Title = model.Title;
            Bus.Send("MyPathX.Services.GoalManagement", command);

            return Json("OK");
        }
        public void AddSetsTitle()
        {
            var title = StringsForTest.RandomString();
            var message = new CreateGoalMessage();
            _messageCreatorMock.Setup(p => p.Create<CreateGoalMessage>()).Returns(message);
            var addGoalModel = new AddGoalModel { Title = title };
            _instanceUnderTest.Add(addGoalModel);

            Assert.AreEqual(message.Title, title);
        }
        public void AddSetsName()
        {
            var name = StringsForTest.RandomString();
            var message = new CreateGoalMessage();
            _messageCreatorMock.Setup(p => p.Create<CreateGoalMessage>()).Returns(message);
            var addGoalModel = new AddGoalModel { Name = name, Description = StringsForTest.RandomString() };
            _instanceUnderTest.Add(addGoalModel);

            Assert.AreEqual(message.Name, name);
        }