示例#1
0
        public void should_parse_music_contract()
        {
            // Artist | Title | Usages | StartDate | EndDate

            // arrange
            var mockDateService = new Mock <IDateService>();

            mockDateService.Setup(x => x.ParseLongDateFormat(It.IsAny <string>()))
            .Returns(new DateTime(2012, 2, 1));
            var repo     = new MusicContractsFileRepo("test", mockDateService.Object);
            var partners = new List <DistributionPartner> {
                new DistributionPartner("partner", "streaming")
            };


            // act
            var result = repo.Parse("Tinie Tempah | Frisky(Live from SoHo) | digital download, streaming | 1st Feb 2012 |", partners);

            // assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Tinie Tempah", result.Artist);
            Assert.AreEqual("Frisky(Live from SoHo)", result.Title);
            Assert.AreEqual("partner", result.Usages[0].Partner);
            Assert.AreEqual(new DateTime(2012, 2, 1), result.StartDate);
        }
示例#2
0
        public void should_throw_error_for_incorrect_input()
        {
            // arrange
            var mockDateService = new Mock <IDateService>();
            var repo            = new MusicContractsFileRepo("test", mockDateService.Object);
            var list            = new List <DistributionPartner>();

            // act
            var result = repo.Parse("|", list);

            // assert
            Assert.Fail("error should occur");
        }