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); }
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(); }