예제 #1
0
        public async Task Create_Bar()
        {
            //arrange
            string barName = "testName";

            byte[] coverPhoto              = new byte[0];
            var    mockCountryService      = new Mock <ICountryService>().Object;
            var    mockCityService         = new Mock <ICityService>().Object;
            var    mockCocktailService     = new Mock <ICocktailService>().Object;
            var    mockNotificationService = new Mock <INotificationService>().Object;
            var    options = TestUtilities.GetOptions(nameof(Create_Bar));

            using (var assertContext = new CocktailDatabaseContext(options))
            {
                var sut = new BarService(assertContext, mockCountryService, mockCityService, mockCocktailService, mockNotificationService);
                await sut.AddBarAsync(barName, "se taq", "se taq", "se taq", "se taq", coverPhoto);
            }
            using (var assertContext = new CocktailDatabaseContext(options))
            {
                Assert.AreEqual(1, assertContext.Bars.Count());
                var bar = await assertContext.Bars.FirstOrDefaultAsync(u => u.Name == barName);

                Assert.IsNotNull(bar);
            }
        }
예제 #2
0
        public async Task ThrowArgumentException_EmptyAddress()
        {
            //arrange
            string testAddress = "";

            byte[] coverPhoto              = new byte[0];
            var    mockCountryService      = new Mock <ICountryService>().Object;
            var    mockCityService         = new Mock <ICityService>().Object;
            var    mockCocktailService     = new Mock <ICocktailService>().Object;
            var    mockNotificationService = new Mock <INotificationService>().Object;
            var    options = TestUtilities.GetOptions(nameof(ThrowArgumentException_EmptyAddress));

            using (var assertContext = new CocktailDatabaseContext(options))
            {
                var sut = new BarService(assertContext, mockCountryService, mockCityService, mockCocktailService, mockNotificationService);
                await sut.AddBarAsync("se taq", testAddress, "se taq", "se taq", "se taq", coverPhoto);
            }
        }