コード例 #1
0
        public void GetUpcomingGigsByArtist_ShouldNotBeReturned()
        {
            var gig = new Gig {
                DateTime = DateTime.Now.AddDays(-1), ArtistId = "1"
            };

            //  _mockGigs.SetSource(new List<Gig> { gig }); or you could write the code below.
            _mockGigs.SetSource(new[] { gig });
            var gigs = _repository.GetUpcomingGigsByArtist("1");

            gigs.Should().BeEmpty();
        }
コード例 #2
0
ファイル: GigRepositoryTests.cs プロジェクト: aparrett/Gighub
        public void GetUpcomingGigsByArtist_GigIsInThePast_ShouldNotBeReturned()
        {
            var gig = new Gig {
                DateTime = DateTime.Now.AddDays(-1), ArtistId = "1"
            };

            _mockGigs.SetSource(new[] { gig });

            var gigs = _repository.GetUpcomingGigsByArtist("1");

            gigs.Should().BeEmpty();
        }
コード例 #3
0
        public void GetUpcomingGigsByArtist_GigIsInThePast_ShouldNotBeReturned()
        {
            var gig = new Gig()
            {
                DateTime = DateTime.Now.AddDays(-5), ArtistId = "1"
            };

            _mockGigs.SetSource(new[] { gig });
            _mockContext.SetupGet(r => r.Gigs).Returns(_mockGigs.Object);

            var gigs = _gigRepository.GetUpcomingGigsByArtist("1");

            gigs.Should().BeEmpty();
        }
コード例 #4
0
        public void GetUpcomingGigsByArtist_GigsInThePast_ShouldNotBeReturned()
        {
            //arrange
            var gig = new Gig()
            {
                DateTime = DateTime.Now.AddDays(-1), ArtistId = "1"
            };

            _mockGigs.SetSource(new [] { gig });
            //act
            var gigs = _repository.GetUpcomingGigsByArtist(gig.ArtistId);

            //assert
            gigs.Should().BeEmpty();
        }
コード例 #5
0
        public void GetUpcomingGigsByArtist_GigIsInThePast_ShouldNotToBeReturned()
        {
            string userId = "1";
            //arrange
            var gig = new Gig {
                DateTime = DateTime.Now.AddDays(-1), ArtistId = userId
            };

            mockGig.SetSource(new List <Gig> {
                gig
            });
            //act
            var gigs = _gigRepository.GetUpcomingGigsByArtist(userId);

            gigs.Should().BeEmpty();
        }
コード例 #6
0
        public void GetUpcomingGigsByArtist_YesterGig_ShouldReturnNull()
        {
            var gig = new Gig
            {
                ID       = 1,
                DateTime = System.DateTime.Now.AddDays(-1),
                GenreID  = 1,
                ArtistID = "1"
                           //  Genre = new Genre {ID = 1 , Name = "Cai luong"}
            };

            _mockGig.SetSource(new[] { gig });

            var gigInfo = _gigRepository.GetUpcomingGigsByArtist("1");

            gigInfo.Should().BeEmpty();
        }
コード例 #7
0
        public void GetUpcomingGigsByArtist_GigIsInThePast_ShouldNotBeReturned()
        {
            //LD we create a gig
            var gig = new Gig()
            {
                DateTime = System.DateTime.Now.AddDays(-1), ArtistId = "1"
            };

            //LD we create a list of gig and set as "SOURCE" of our MOCK "_mockGigs"
            _mockGigs.SetSource(new[] { gig });


            //LD NOW I DO THE ACTION!!! I call my repository by "_repository"
            // and save the return in "gigs".
            var gigs = _repository.GetUpcomingGigsByArtist("1");

            //LD now I do the ASSERT
            gigs.Should().BeEmpty();
        }