public void RemoveCategoryByValueTest() { // Arrange Category category1 = new Category(1) { Name = "Health", Color = Color.Green }; Category category2 = new Category(2) { Name = "Eat", Color = Color.Red }; Wallet wallet1 = new Wallet(1) { Name = "Wall_let", Currency = "UAH" }; wallet1.AddCategory(category1); // Act bool remC1 = wallet1.RemoveCategory(category1); bool remC2 = wallet1.RemoveCategory(category2); // Assert Assert.True(remC1); Assert.False(remC2); }
public void GetCategoriesTest() { // Arrange Wallet wallet1 = new Wallet(Guid.NewGuid(), "Wall_let", "desc", "UAH", 0, Guid.NewGuid()); List <Category> categories = new List <Category>(); for (int i = 0; i < 10; i++) { Category category1 = new Category(i) { Name = "Salary" + i, Color = Color.Blue }; categories.Add(category1); wallet1.AddCategory(category1); } // Act List <Category> actual = wallet1.GetCategories(); // Assert for (int i = 0; i < 10; i++) { Assert.Equal(categories[i], actual[i]); } }
public void AddTransactionTest() { // Arrange Category categoryHealth = new Category(1) { Name = "Health", Color = Color.Green }; Category categoryEat = new Category(2) { Name = "Eat", Color = Color.Red }; Wallet walletNoCategories = new Wallet(Guid.NewGuid(), "Without categories", "desc", "UAH", 0, Guid.NewGuid()); Wallet walletHealthCategory = new Wallet(Guid.NewGuid(), "With category (Health)", "desc", "USD", 0, Guid.NewGuid()); walletHealthCategory.AddCategory(categoryHealth); Transaction transactionEat = new Transaction(Guid.NewGuid(), -10.10M, "UAH", categoryEat, "", DateTimeOffset.Now); Transaction transactionHealth = new Transaction(Guid.NewGuid(), -2.02M, "UAH", categoryHealth, "", DateTimeOffset.Now); // Act bool wncAddTe = walletNoCategories.AddTransaction(transactionEat); bool wncAddTh = walletNoCategories.AddTransaction(transactionHealth); bool whcAddTe = walletHealthCategory.AddTransaction(transactionEat); bool whcAddTh = walletHealthCategory.AddTransaction(transactionHealth); // Assert Assert.True(wncAddTe); Assert.True(wncAddTh); Assert.Equal(2, walletNoCategories.GetTenRecentlyAddedTransactions().Count); Assert.False(whcAddTe); Assert.True(whcAddTh); Assert.Single(walletHealthCategory.GetTenRecentlyAddedTransactions()); }
public void AddCategoryTest() { // Arrange Category category1 = new Category(1) { Name = "Health", Color = Color.Green }; Wallet wallet1 = new Wallet(Guid.NewGuid(), "Wall_let", "desc", "UAH", 0, Guid.NewGuid()); // Act bool actualAddFirstTime = wallet1.AddCategory(category1); bool actualAddSecondTime = wallet1.AddCategory(category1); // Assert Assert.True(actualAddFirstTime); Assert.False(actualAddSecondTime); }
public void AddCategoryTest() { // Arrange Category category1 = new Category(1) { Name = "Health", Color = Color.Green }; Wallet wallet1 = new Wallet(1) { Name = "Wall_let", Currency = "UAH" }; // Act bool actualAddFirstTime = wallet1.AddCategory(category1); bool actualAddSecondTime = wallet1.AddCategory(category1); // Assert Assert.True(actualAddFirstTime); Assert.False(actualAddSecondTime); }
public void AddTransactionTest() { // Arrange Category categoryHealth = new Category(1) { Name = "Health", Color = Color.Green }; Category categoryEat = new Category(2) { Name = "Eat", Color = Color.Red }; Wallet walletNoCategories = new Wallet(1) { Name = "Without categories", Currency = "UAH" }; Wallet walletHealthCategory = new Wallet(2) { Name = "With category (Health)", Currency = "USD" }; walletHealthCategory.AddCategory(categoryHealth); Transaction transactionEat = new Transaction(1) { Sum = -10.10M, Currency = "UAH", Category = categoryEat, Date = DateTime.Today }; Transaction transactionHealth = new Transaction(2) { Sum = -2.02M, Currency = "UAH", Category = categoryHealth, Date = DateTime.Today }; // Act bool wncAddTe = walletNoCategories.AddTransaction(transactionEat); bool wncAddTh = walletNoCategories.AddTransaction(transactionHealth); bool whcAddTe = walletHealthCategory.AddTransaction(transactionEat); bool whcAddTh = walletHealthCategory.AddTransaction(transactionHealth); // Assert Assert.True(wncAddTe); Assert.True(wncAddTh); Assert.Equal(2, walletNoCategories.GetTenRecentlyAddedTransactions().Count); Assert.False(whcAddTe); Assert.True(whcAddTh); Assert.Single(walletHealthCategory.GetTenRecentlyAddedTransactions()); }
public void TestWalletAddingCategories() { // var testCustomer = new Customer("Vasilii", "Poberezhnii", "*****@*****.**"); var testCategory = new Category("OneTwo", "", "", ""); testCustomer.AddCategory(testCategory); var testName = "wallet1"; var testWallet = new Wallet(testCustomer, testName, 0, "", "UAH"); // var testCategory2 = new Category("OneTwoThree", "", "", ""); testCustomer.AddCategory(testCategory2); testWallet.AddCategory(testCategory2); // Assert.True(testWallet.GetCategories()[1].Equals(testCategory2)); }
public void GetCategoryTest() { // Arrange Category category1 = new Category(1) { Name = "Salary", Color = Color.Blue }; Wallet wallet1 = new Wallet(Guid.NewGuid(), "Wall_let", "desc", "UAH", 0, Guid.NewGuid()); wallet1.AddCategory(category1); // Act Category actualNonNull = wallet1.GetCategory(1); Category actualNull = wallet1.GetCategory(0); // Assert Assert.Equal(category1, actualNonNull); Assert.Null(actualNull); }
public void RemoveCategoryByIndexTest() { // Arrange Category category1 = new Category(1) { Name = "Salary", Color = Color.Blue }; Wallet wallet1 = new Wallet(Guid.NewGuid(), "Wall_let", "desc", "UAH", 0, Guid.NewGuid()); wallet1.AddCategory(category1); // Act bool remC1 = wallet1.RemoveCategory(1); bool remC2 = wallet1.RemoveCategory(0); // Assert Assert.True(remC1); Assert.False(remC2); }
public void GetCategoryTest() { // Arrange Category category1 = new Category(1) { Name = "Salary", Color = Color.Blue }; Wallet wallet1 = new Wallet(1) { Name = "Wall_let", Currency = "UAH" }; wallet1.AddCategory(category1); // Act Category actualNonNull = wallet1.GetCategory(1); Category actualNull = wallet1.GetCategory(0); // Assert Assert.Equal(category1, actualNonNull); Assert.Null(actualNull); }
public void RemoveCategoryByIndexTest() { // Arrange Category category1 = new Category(1) { Name = "Salary", Color = Color.Blue }; Wallet wallet1 = new Wallet(1) { Name = "Wall_let", Currency = "UAH" }; wallet1.AddCategory(category1); // Act bool remC1 = wallet1.RemoveCategory(1); bool remC2 = wallet1.RemoveCategory(0); // Assert Assert.True(remC1); Assert.False(remC2); }