예제 #1
0
        private static async Task <OfficeElements> CreateTaskAsync()
        {
            _dateInterface = Substitute.For <IGetDate>();
            _dateInterface.GetCurrentDate().Returns(DateTime.Parse("2020-01-01"));

            MainSql.CreateConnection();
            await MainSql.CkeckConnectionAsync();

            await MainSql.CreateAsync(new TestUserHelpers(), new TestInternetAccess(), "1111");

            return(await OfficeElements.CreateAsync(_dateInterface).ConfigureAwait(false));
        }
        public async Task CreateAsync_IncorrectUser_ReturnsNullAsync(string pin)
        {
            var dateInterface = Substitute.For <IGetDate>();

            dateInterface.GetCurrentDate().Returns(DateTime.Parse("2020-01-01"));

            MainSql.CreateConnection();
            await MainSql.CkeckConnectionAsync();

            Task AsyncTestDelegate() => MainSql.CreateAsync(new TestUserHelpers(), new TestInternetAccess(), pin);

            Assert.CatchAsync <NoUserFound>(AsyncTestDelegate);
        }
예제 #3
0
        public async Task CleanupAsync()
        {
            MainSql.SetNullConnection();

            var dateInterface = Substitute.For <IGetDate>();

            dateInterface.GetCurrentDate().Returns(DateTime.Parse("2020-01-01"));

            MainSql.CreateConnection();
            await MainSql.CkeckConnectionAsync();

            await MainSql.CreateAsync(new TestUserHelpers(), new TestInternetAccess(), "1111");

            await MainSql.DeleteFromDbAsync(true, null, "2020-01-01").ConfigureAwait(false);

            MainSql.SetNullConnection();
        }