예제 #1
0
        public void UseRepositoryWhenRadioIsDeleted()
        {
            // arrange
            var mockedRadioRepository = RadioRepositoryBuilder.Create();

            mockedRadioRepository.Radios.Add(("djam", new Uri("http://djam.fr")));
            var radioRepository = mockedRadioRepository.Build();
            var radioHandler    = new RadioHandler(radioRepository);

            // act
            radioHandler.Handle(new RadioDeleted("djam"));
            // assert
            Assert.AreEqual(0, mockedRadioRepository.Radios.Count);
        }
예제 #2
0
        public void UseRepositoryWhenRadioIsCreated()
        {
            // arrange
            var mockedRadioRepository = RadioRepositoryBuilder.Create();
            var radioRepository       = mockedRadioRepository.Build();
            var radioHandler          = new RadioHandler(radioRepository);

            (string name, Uri url) = ("djam", new Uri("http://djam.fr"));
            // act
            radioHandler.Handle(new RadioCreated("djam", new Uri("http://djam.fr")));
            // assert
            var(actualName, actualUrl) = mockedRadioRepository.Radios.First();
            Assert.AreEqual(name, actualName);
            Assert.AreEqual(url, actualUrl);
        }