public SubmitServiceTests() { _mockEnvironment.Setup(_ => _.EnvironmentName) .Returns("local"); _mockIOptions.Setup(_ => _.Value) .Returns(new SubmissionServiceConfiguration { FakePaymentSubmission = false }); _service = new SubmitService(_mockGateway.Object, _mockPageHelper.Object, _mockEnvironment.Object, _mockIOptions.Object); }
public void SubmitFingerprint(string path) { var fingerprint = GenerateFingerprint(path); var file = TagLib.File.Create(path); var duration = (int)file.Properties.Duration.TotalSeconds; file.Dispose(); SubmitService service = new SubmitService("OL52LsoEE3"); SubmitRequest request = new SubmitRequest(fingerprint, duration) { Album = file.Tag.Album, Artist = file.Tag.FirstPerformer, Title = file.Tag.Title, AlbumArtist = file.Tag.FirstAlbumArtist }; var task = service.SubmitAsync(request); task.Wait(); }
public void GetCategories_ShouldReturnInstanceOfSelectList() { //Arrange var mockSubmitFactory = new Mock <ISubmitFactory>(); var mockSubmissionRepository = new Mock <IRepository <Submission> >(); var mockCategoryRepository = new Mock <IRepository <Category> >(); var mockDateTimeProvider = new Mock <IDateTimeProvider>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var service = new SubmitService(mockSubmitFactory.Object, mockSubmissionRepository.Object, mockCategoryRepository.Object, mockDateTimeProvider.Object, mockUnitOfWork.Object ); //Act var categories = service.GetCategories(); //Assert Assert.IsInstanceOf <SelectList>(categories); }
public void GetCategories_ShouldCallCategoryRepositoryGetALl() { //Arrange var mockSubmitFactory = new Mock <ISubmitFactory>(); var mockSubmissionRepository = new Mock <IRepository <Submission> >(); var mockCategoryRepository = new Mock <IRepository <Category> >(); var mockDateTimeProvider = new Mock <IDateTimeProvider>(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var service = new SubmitService(mockSubmitFactory.Object, mockSubmissionRepository.Object, mockCategoryRepository.Object, mockDateTimeProvider.Object, mockUnitOfWork.Object ); //Act service.GetCategories(); //Assert mockCategoryRepository.Verify(x => x.Entities, Times.Once); }