コード例 #1
0
        public void SetUserCurrentWorkTask_ThatDontExists_MustThrowException()
        {
            var inMemRepo = new InMemRepoImpl();

            var inMemCommandHandler = new SetUserCurrentWorkTaskCommandHandler(inMemRepo);

            // Some work task id that don't exists
            Guid workTaskId = Guid.NewGuid();

            Assert.Throws <ArgumentException>(() => inMemCommandHandler.HandleAsync(new SetUserCurrentWorkTaskMutation("hans", workTaskId)).Result);
        }
コード例 #2
0
        public void SetUserCurrentWorkTask_ThatExists_QueryMustReturnWorkTask()
        {
            var repo = new InMemRepoImpl();

            var commandHandler = new SetUserCurrentWorkTaskCommandHandler(repo);

            var queryHandler = new UserWorkContextQueryHandler(repo);

            Guid workTaskId = Guid.Parse("08ce7a8f-4ad9-4b03-8386-86d3cebf408a");

            var mutationResult = commandHandler.HandleAsync(new SetUserCurrentWorkTaskMutation("hans", workTaskId)).Result;

            var queryResult = queryHandler.HandleAsync(new UserWorkContextQuery("hans")).Result;

            Assert.Equal(workTaskId, queryResult.UserWorkContext.CurrentWorkTask.MRID);

            Assert.NotNull(queryResult.UserWorkContext.CurrentWorkTask.Project);
        }