public void UT_Admin_categories() { var repo = new mockAdminRepository(); var service = new AdminCategoriesV1(repo); var resp = service.Exec(null, new AuthenticatedUser(), 0, 10); if (resp.list.Count != 1) { Assert.Fail("categories // fail 1"); } if (resp.total != 1) { Assert.Fail("categories // fail 2"); } if (resp.list[0].Id != 1) { Assert.Fail("categories // fail 3.1"); } if (resp.list[0].Name != "teste") { Assert.Fail("categories // fail 3.2"); } }
public void UT_Admin_CreateAccount_NameInvalid() { var repo = new mockAdminRepository(); var service = new AdminCreateAccountV1(repo); if (service.Exec(null, new NewUserData { Name = "" })) { Assert.Fail("CreateAccount // Name empty accepted"); } }
public void UT_Admin_CreateCategory_OK() { var repo = new mockAdminRepository(); var service = new AdminCreateCategoryV1(repo); if (!service.Exec(null, new NewCategoryData { Name = "pass" })) { Assert.Fail("CreateCategory // Not existing user should create account"); } }
public void UT_Admin_CreateCategory_CategoryExist() { var repo = new mockAdminRepository(); var service = new AdminCreateCategoryV1(repo); if (service.Exec(null, new NewCategoryData { Name = "xxx" })) { Assert.Fail("CreateCategory // Existing user cannot create same account"); } }
public void UT_Admin_EditProduct_OK() { var repo = new mockAdminRepository(); var service = new AdminEditProductV1(repo); if (!service.Exec(null, new AuthenticatedUser(), new NewProductData { Name = "test", Id = 1 })) { Assert.Fail("EditProduct // Data ok should edit"); } }
public void UT_Admin_EditCategory_IdInvalid() { var repo = new mockAdminRepository(); var service = new AdminEditCategoryV1(repo); if (service.Exec(null, new NewCategoryData { Name = "xxxx", Id = 9999999 })) { Assert.Fail("EditCategory // Id invalid"); } }
public void UT_Admin_CreateAccount_UserExist() { var repo = new mockAdminRepository(); var service = new AdminCreateAccountV1(repo); if (service.Exec(null, new NewUserData { Name = "xxx", Email = "*****@*****.**", Password = "******" })) { Assert.Fail("CreateAccount // Existing user cannot create same account"); } }
public void UT_Admin_EditProduct_IdInvalid() { var repo = new mockAdminRepository(); var service = new AdminEditProductV1(repo); if (service.Exec(null, new AuthenticatedUser(), new NewProductData { Name = "test", Id = 0 })) { Assert.Fail("EditProduct // Name empty accepted"); } }
public void UT_Admin_CreateAccount_PasswordInvalid_2() { var repo = new mockAdminRepository(); var service = new AdminCreateAccountV1(repo); if (service.Exec(null, new NewUserData { Name = "xxx", Email = "*****@*****.**", Password = "******" })) { Assert.Fail("CreateAccount // cannot be empty"); } }
public void UT_Admin_CreateAccount_EmailInvalid_3() { var repo = new mockAdminRepository(); var service = new AdminCreateAccountV1(repo); if (service.Exec(null, new NewUserData { Name = "xxx", Email = "fddd@fdsd" })) { Assert.Fail("CreateAccount // Email invalid 3 accepted"); } }
public void UT_Admin_CreateAccount_OK() { var repo = new mockAdminRepository(); var service = new AdminCreateAccountV1(repo); if (!service.Exec(null, new NewUserData { Name = "xxx", Email = "*****@*****.**", Password = "******" })) { Assert.Fail("CreateAccount // Not existing user should create account"); } }
public void UT_Admin_EditSubCategory_NameInvalid() { var repo = new mockAdminRepository(); var service = new AdminEditSubCategoryV1(repo); if (service.Exec(null, new NewSubCategoryData { Name = "", Id = 1 })) { Assert.Fail("EditSubCategory // Name empty accepted"); } }
public void UT_Admin_EditSubCategory_OK() { var repo = new mockAdminRepository(); var service = new AdminEditSubCategoryV1(repo); if (!service.Exec(null, new NewSubCategoryData { Name = "xxx", Id = 1 })) { Assert.Fail("EditSubCategory // Not existing user should create account"); } }
public void UT_Admin_CreateProduct_NameInvalid() { var repo = new mockAdminRepository(); var service = new AdminCreateProductV1(repo); if (service.Exec(null, new AuthenticatedUser(), new NewProductData { Name = "" })) { Assert.Fail("CreateProduct // Name empty accepted"); } }
public void UT_Admin_products() { var repo = new mockAdminRepository(); var service = new AdminProductsV1(repo); var resp = service.Exec(null, 1, 1, 0, 10); if (resp.list.Count != 1) { Assert.Fail("products // fail 1"); } }
public void UT_Admin_CreateProduct_SubCategID_Invalid() { var repo = new mockAdminRepository(); var service = new AdminCreateProductV1(repo); if (service.Exec(null, new AuthenticatedUser(), new NewProductData { Name = "test", ProductCategoryID = 1, ProductSubCategoryID = 0 })) { Assert.Fail("CreateProduct // Subcategory invalid accepted"); } }
public void UT_Admin_CreateProduct_Product_OK() { var repo = new mockAdminRepository(); var service = new AdminCreateProductV1(repo); if (!service.Exec(null, new AuthenticatedUser(), new NewProductData { Name = "test", ProductCategoryID = 1, ProductSubCategoryID = 2 })) { Assert.Fail("CreateProduct // OKk and was not created"); } }
public void UT_Admin_CreateCategory_OK() { var repo = new mockAdminRepository(); var service = new AdminCreateSubCategoryV1(repo); if (!service.Exec(null, new NewSubCategoryData { ProductCategoryID = 1, Name = "xxx" })) { Assert.Fail("CreateSubCategory // ok not passed"); } }
public void UT_Admin_CreateSubCategory_NameInvalid() { var repo = new mockAdminRepository(); var service = new AdminCreateSubCategoryV1(repo); if (service.Exec(null, new NewSubCategoryData { ProductCategoryID = 1, Name = "" })) { Assert.Fail("CreateSubCategory // Name empty accepted"); } }
public void UT_Admin_Authenticate_OK() { var repo = new mockAdminRepository(); var service = new AdminAuthenticateV1(repo); var ua = new AuthenticatedUser(); if (!service.Exec(null, new LoginInformation { Login = "******", Passwd = "123456" }, ref ua)) { Assert.Fail("Authenticate // Failed!"); } }
public void UT_Admin_Authenticate_PasswordInvalid_2() { var repo = new mockAdminRepository(); var service = new AdminAuthenticateV1(repo); var ua = new AuthenticatedUser(); if (service.Exec(null, new LoginInformation { Login = "******", Passwd = "123" }, ref ua)) { Assert.Fail("Authenticate // Password invalid passed"); } }
public void UT_Admin_Authenticate_LoginInvalid() { var repo = new mockAdminRepository(); var service = new AdminAuthenticateV1(repo); var ua = new AuthenticatedUser(); if (service.Exec(null, new LoginInformation { Login = "" }, ref ua)) { Assert.Fail("Authenticate // Login empty accepted"); } }
public void UT_Admin_category() { var repo = new mockAdminRepository(); var service = new AdminCategoryV1(repo); var resp = service.Exec(null, new AuthenticatedUser(), 1); if (resp.Id != 1) { Assert.Fail("category // fail 1"); } if (resp.Name != "test") { Assert.Fail("category // fail 2"); } }
public void UT_Admin_product() { var repo = new mockAdminRepository(); var service = new AdminProductV1(repo); var resp = service.Exec(null, 1); if (resp.Id != 1) { Assert.Fail("product // fail 1"); } if (resp.Name != "test") { Assert.Fail("product // fail 2"); } }