コード例 #1
0
        public void PostConcert_Returns_Concert()
        {
            var concertResponse = ConcertTestData.GetCreatedConcert();
            var response        = _controller.CreateConcert(true, _concert);

            Assert.IsTrue(DeepEqualityComparer.AreEqual(concertResponse, response.Concert));
        }
コード例 #2
0
ファイル: GetConcerts.cs プロジェクト: tonyazen/ConcertDiary
        public void Intialize()
        {
            _concertService = new Mock <IConcertService>();
            _tweetService   = new Mock <ITweetService>();
            _controller     = new ConcertsController(_concertService.Object, _tweetService.Object);

            _request = new HttpRequestMessage();
            _request.Headers.Add("app_id", "testapp");
            _request.Headers.Add("user", "testuser");

            _controller.Request = _request;

            _concertService.Setup(s => s.GetConcerts(It.IsAny <string>()))
            .Returns(() => new ConcertsResponse
            {
                Concerts = ConcertTestData.GetAllConcerts()
            });
        }
コード例 #3
0
        public void Intialize()
        {
            _concertService = new Mock <IConcertService>();
            _tweetService   = new Mock <ITweetService>();
            _controller     = new ConcertsController(_concertService.Object, _tweetService.Object);

            _request = new HttpRequestMessage();
            _request.Headers.Add("app_id", "testapp");
            _request.Headers.Add("user", "testuser");

            _controller.Request = _request;

            _concertService.Setup(s => s.CreateConcert(It.IsAny <string>(), It.IsAny <Concert>()))
            .Returns(() => new CreateUpdateConcertResponse
            {
                RequestId = _requestId,
                Concert   = ConcertTestData.GetCreatedConcert(),
            });

            _tweetService.Setup(s => s.TweetConcert(It.IsAny <Concert>()))
            .Returns(() => _tweetUrl);

            _concert = ConcertTestData.GetConcertToCreate();
        }