示例#1
0
        public Goal Create(string name, string description, string title)
        {
            var entity = new Goal(name, description, title);

            _repository.Add(entity);

            return entity;
        }
        public void CreatesGoal()
        {
            var name = StringsForTest.RandomString();
            var description = StringsForTest.RandomString();
            var title = StringsForTest.RandomString();
            var entity = new Goal(StringsForTest.RandomString(), StringsForTest.RandomString(), StringsForTest.RandomString());

            var goalCreator = new Mock<IGoalCreator>();
            var bus = new Mock<IBus>();
            var sut = new CreateGoalHandler(bus.Object, goalCreator.Object);

            sut.Handle(new CreateGoalMessage { Name = name, Description = description, Title = title });

            goalCreator.Verify(p => p.Create(name, description, title));
        }