public async Task Add_Banner() { var options = DatabaseOrganisation.GetOptions(nameof(Add_Banner)); var bannerDTOMapper = new Mock <IDtoMapper <Banner, BannerDTO> >(); using (var arrangeContext = new ApplicationDbContext(options)) { var bannerDTOMapperMock = new Mock <IDtoMapper <Banner, BannerDTO> > (); bannerDTOMapperMock.Setup(x => x.MapFrom(It.IsAny <Banner>())).Returns(TestUtils.bannerDTO1); var sut = new BannerService(arrangeContext, bannerDTOMapperMock.Object, null); var banner = await sut.AddBannerAsync("path", "01.01.2018", "01.01.2019", "bmw.bg"); Assert.IsInstanceOfType(banner, typeof(BannerDTO)); Assert.AreEqual(arrangeContext.Banners.First().ImagePath, "path"); Assert.AreEqual(arrangeContext.Banners.First().StartDate, DateTime.Parse("01.01.2018")); Assert.AreEqual(arrangeContext.Banners.First().EndDate, DateTime.Parse("01.01.2019")); } }