public async void CreateAsync_Should_Return_Correct_Data() { const string id = "123"; //arrange var mockedRepo = new Mock <IGenericRepository <SubmissionVM> >(); var mockedConfigRepo = new Mock <IGenericRepository <ConfigVM> >(); var mockedConfig = new Mock <IAppConfiguration <ConfigVM> >(); var sut = new SubmissionService(mockedRepo.Object, mockedConfigRepo.Object, mockedConfig.Object); mockedRepo.Setup(x => x.CreateAsync(It.IsAny <SubmissionVM>())).ReturnsAsync(new SubmissionVM { Id = id }); //act var result = await sut.CreateAsync(new SubmissionVM { Id = id }); //assert result.Id.Should().Be(id); }
public async void CreateAsync_Should_Not_Be_null() { const string id = "123"; //arrange var mockedRepo = new Mock <IGenericRepository <SubmissionVM> >(); var mockedConfigRepo = new Mock <IGenericRepository <ConfigVM> >(); var mockedConfig = new Mock <IAppConfiguration <ConfigVM> >(); //var mockedIdGenerator = new Mock<IUidGeneratorService>(); var mockedAppSettings = new Mock <IConfiguration>(); var sut = new SubmissionService(mockedRepo.Object, mockedConfigRepo.Object, mockedConfig.Object, mockedAppSettings.Object); mockedRepo.Setup(x => x.CreateAsync(It.IsAny <SubmissionVM>())).ReturnsAsync(new SubmissionVM { Id = id }); //act var result = await sut.CreateAsync(new SubmissionVM { Id = id }); //assert result.Should().NotBeNull(); }
public async void CreateAsync_Should_Return_Correct_Data() { const string id = "123"; //arrange var mockedRepo = new Mock <IGenericRepository <SubmissionVM> >(); var mockedServiceBusService = new Mock <IServiceBusService>(); var mockedJobClient = new Mock <IBackgroundJobClient>(); var mockedConfigRepo = new Mock <IGenericRepository <ConfigVM> >(); var mockedConfig = new Mock <IAppConfiguration <ConfigVM> >(); var mockedAppSettings = new Mock <IConfiguration>(); //var mockedIdGenerator = new Mock<IUidGeneratorService>(); var sut = new SubmissionService(mockedRepo.Object, mockedServiceBusService.Object, mockedJobClient.Object); //, mockedConfigRepo.Object, mockedConfig.Object, mockedAppSettings.Object); mockedRepo.Setup(x => x.CreateAsync(It.IsAny <SubmissionVM>())).ReturnsAsync(new SubmissionVM { Id = id }); //act var result = await sut.CreateAsync(new SubmissionVM { Id = id }); //assert result.Id.Should().Be(id); }