// [TestMethod] public async Task NullDeleteTest() { Assert.IsFalse(await TestFactoty.Current.FundRepository.DeleteAsync(Identificator.GenerateNewId())); await Assert.ThrowsExceptionAsync <ArgumentNullException>( async() => await TestFactoty.Current.FundRepository.DeleteAsync(null)); }
public void AddDefaultUsers() { Users.Add(new User { Id = Identificator <User> .GenerateId(), Name = "Admin", Surname = "Adminov", Email = "admin@", Password = "******", UserRole = Roles.UserRole.Admin } ); Users.Add(new User { Id = Identificator <User> .GenerateId(), Name = "Ali", Surname = "Mecidzade", Email = "*****@*****.**", Password = "******", UserRole = Roles.UserRole.User } ); }
public async Task <Transaction> GetByIdAsync(Identificator id, CancellationToken token = default) => await( await( await _bundle.TransactionRepository.Collection .FindAsync(s => s.Id == id.ToString())) .FirstOrDefaultAsync()) .ToEntityAsync(_transactionTypeRepository, token);
public void TestPdf() { //var pdfFile = File.ReadAllBytes(Path.Combine(Statics.AppPath(), @"TestResources\MetadataFiles\dummy.pdf")); var identificator = new Identificator(@"D:\Tools\droid-binary-6.4-binx\droid.bat", @"D:\TopX_Data\TestFiles", new Mock <NLog.Logger>().Object); identificator.IdentifyFiles(null); }
public TransactionType( Identificator id, string name, TransactionType reverseType, TypeVariation typeVariation) : base(id, name) { ReverseType = reverseType; TypeVariation = typeVariation; }
public async Task GetInfos() { Identificator identificator = new Identificator(); Identificator.CharacInfo infos = await identificator.GetAnime("Chino", "Kafuu"); Assert.Equal("gochuumon_wa_usagi_desu_ka?", infos.source); Assert.Equal("blue", infos.eyesColor); Assert.Equal("blue", infos.hairColor); }
// [TestMethod] public async Task DeleteTest() { f1FundTestId = Identificator.GenerateNewId(); f1Fund = new Fund(f1FundTestId, "Test Fund 2", "Description", null); await TestFactoty.Current.FundRepository.AddAsync(f1Fund); Assert.IsTrue(await TestFactoty.Current.FundRepository.DeleteAsync(f1FundTestId)); }
public async Task <bool> DeleteAsync(Identificator id, CancellationToken token = default) { var curItem = await GetByIdAsync(id, token); var deleteResult = await _bundle.TransactionRepository.Collection.DeleteOneAsync( new ExpressionFilterDefinition <TransactionDTO>(s => s.Id == id.ToString()), token); return(deleteResult.IsAcknowledged && (deleteResult.DeletedCount == 1)); }
// [TestMethod] public async Task NullReadWriteAsyncTest() { f1Fund = new Fund(null, "Test Fund 1", "Description", null); Assert.IsNull(await TestFactoty.Current.FundRepository.AddAsync(f1Fund)); Assert.IsNull(await TestFactoty.Current.FundRepository.GetByIdAsync(null)); Assert.IsNull(await TestFactoty.Current.FundRepository.GetByIdAsync(Identificator.GenerateNewId())); }
// [TestMethod] public async Task GetAllTest() { await TestFactoty.Current.FundRepository.AddAsync(new Fund(Identificator.GenerateNewId(), "Test Fund 1", "Description", null)); await TestFactoty.Current.FundRepository.AddAsync(new Fund(Identificator.GenerateNewId(), "Test Fund 2", "Description", null)); var result = await TestFactoty.Current.FundRepository.GetAllAsync(); Assert.AreNotEqual(0, result.ToList().Count); Assert.IsNotNull(result); }
public string Check(List <string> arguments) { string id = arguments[0]; Identificator element = (Identificator)this.harvesters.FirstOrDefault(x => x.Id == id) ?? this.providers.FirstOrDefault(p => p.Id == id); if (element != null) { return(element.ToString()); } return($"No element found with id - {id}"); }
public async Task <bool> DeleteAsync(Identificator id, CancellationToken token = default) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var deleteResult = await _collection.DeleteOneAsync( new ExpressionFilterDefinition <FundDTO>(s => s.Id == id.ToString()), token); return(deleteResult.IsAcknowledged && (deleteResult.DeletedCount == 1)); }
public Route( Identificator id, Fund sourceFund, Fund receiverFund, Transaction sourceTransaction, Transaction receiverTransaction) : base(id) { SourceFund = sourceFund; ReceiverFund = receiverFund; SourceTransaction = sourceTransaction; ReceiverTransaction = receiverTransaction; }
public async Task SimpleReadWriteAsyncTest() { f1FundTestId = Identificator.GenerateNewId(); f1Fund = new Fund(f1FundTestId, "Test Fund 1", "Description", null); var testResult1 = await TestFactoty.Current.FundRepository.AddAsync(f1Fund); Assert.AreEqual(f1FundTestId, testResult1); var testResult2 = await TestFactoty.Current.FundRepository.GetByIdAsync(f1FundTestId); Assert.AreEqual(f1Fund.Id.Id, testResult2.Id.Id); }
public async Task UpdateTest() { var fund = new Fund(Identificator.GenerateNewId(), "Test Fund 1", "Description", null); await TestFactoty.Current.FundRepository.AddAsync(fund); var fund1 = new Fund(fund.Id, "Test2", fund.Description, fund.Transactions); var result = await TestFactoty.Current.FundRepository.UpdateAsync(fund1); Assert.IsTrue(result); var result2 = await TestFactoty.Current.FundRepository.GetByIdAsync(fund1.Id); Assert.AreEqual("Test2", result2.Name); }
public Card GetCard() { return(new Card { Id = Identificator <Card> .GetId(), Bank = GetBankName(), CVC = GetCVC(), Duration = GetDurationType(), ExpiredDate = GetExpireADate(), CardType = GetCardType(), CardNumber = GetCardNumber(), CalrdHolder = $"{_user.Name} {_user.Surname}", CardHolderId = _user.Id, Balance = 0 }); }
public async Task <Fund> GetByIdAsync(Identificator id, CancellationToken token = default) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var foundResult = await( await _collection .FindAsync(s => s.Id == id.ToString())) .FirstOrDefaultAsync(); return(foundResult == null ? null : await foundResult?.ToEntityAsync(_transactionRepository, token)); }
protected override bool IsFormValid() { try { return (!String.IsNullOrEmpty(Identificator.Trim()) && !String.IsNullOrEmpty(Name.Trim()) && !String.IsNullOrEmpty(Description.Trim()) && RowOffset >= 0 && ColumnOffset >= 0 && WorksheetIndex > 0 && Fields.All(IsValidField)); } catch (Exception) { return(false); } }
// [TestMethod] public async Task GetByIdsTest() { List <Fund> funds = new List <Fund>() { new Fund(Identificator.GenerateNewId(), "Test Fund 1", "Description", null), new Fund(Identificator.GenerateNewId(), "Test Fund 1", "Description", null), }; var ids = funds.Select(item => item.Id).ToArray(); foreach (var fund in funds) { await TestFactoty.Current.FundRepository.AddAsync(fund); } var result = await TestFactoty.Current.FundRepository.GetByIdsAsync(ids); Assert.AreEqual(2, result.ToList().Count); }
protected EntityBase(Identificator id) =>
public static void Main() { string input = "-154216"; Lexer L = new IntLexer(input); try { int res = L.Save(); System.Console.WriteLine(res); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "a1231dfs3"; L = new Identificator(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "-013"; L = new IntStartsNot0(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "a4f4h2"; L = new LetDig(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "sfdsf,werw,hkkh;u"; L = new StrWithMarks(input); try { L.SaveList(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "wer wrw yyyrtyr er"; L = new StrWithSpaces(input); try { L.SaveList(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "a21ef4r55yu"; L = new GroupLetDig(input); try { string s = L.SaveStr(); System.Console.WriteLine(s); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "242.2342342"; L = new DoubleLex(input); try { double d = L.SaveDouble(); System.Console.WriteLine(d); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "'строка'"; L = new StringLex(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } input = "/*выаы*/"; L = new Comment(input); try { L.Parse(); } catch (LexerException e) { System.Console.WriteLine(e.Message); } System.Console.Read(); }
public override int GetHashCode() { return(Identificator.GetHashCode()); }
public DictionaryBase(Identificator id, string name) : base(id) =>
public async Task CorrectName() { Identificator identificator = new Identificator(); Assert.NotInRange((await identificator.CorrectName("hibiki")).ToArray().Length, 0, 1); }
public async Task <bool> IsExistById(Identificator id, CancellationToken token = default) => (await _collection.CountDocumentsAsync(s => s.Id == id.ToString())) != 0;