public void UpdatePassword_UserWithNoPassword_PasswordCanBeVerified(string password, bool expectedResult) { var user = new User(mMembershipFakeFactory.UserWithoutPassword); var result = manager.CallProtectedUpdatePassword(user, password); CMSAssert.All(() => Assert.AreEqual(expectedResult, result.Succeeded), () => Assert.IsTrue(manager.CallProtectedVerifyPassword(user, password))); }
public void RemoveLoginAsync_NonExistingLogin_NoExceptionNoLoginRemoved() { var user = new User(mMembershipFakeFactory.UserExternal); var login = new UserLoginInfo("fakeProvider", "fakeKey"); CMSAssert.All( () => Assert.DoesNotThrow(() => mUserStore.RemoveLoginAsync(user, login).Wait()), async() => Assert.AreEqual(1, (await mUserStore.GetLoginsAsync(user)).Count)); }
public void GetPaymentMethod_DisabledPaymentMethod_ReturnsPaymentMethod() { var paymentMethod = mRepository.GetById(DISABLED_PAYMENTMETHOD_ID); CMSAssert.All( () => Assert.IsNotNull(paymentMethod, "Returned null for an existing disabled payment option."), () => Assert.AreEqual(DISABLED_PAYMENTMETHOD_ID, paymentMethod.PaymentOptionID, "Incorrect payment option returned.") ); }
protected void AssertPrice(ProductPrice calculatedprice, ProductPrice expectedPrice) { CMSAssert.All( () => Assert.AreEqual(expectedPrice.Discount, calculatedprice.Discount, "Discount {0} does not match the expected value {1}.", new object[] { calculatedprice.Discount, expectedPrice.Discount }), () => Assert.AreEqual(expectedPrice.ListPrice, calculatedprice.ListPrice, "ListPrice {0} does not match the expected value {1}.", new object[] { calculatedprice.ListPrice, expectedPrice.ListPrice }), () => Assert.AreEqual(expectedPrice.Price, calculatedprice.Price, "Price {0} does not match the expected value {1}.", new object[] { calculatedprice.Price, expectedPrice.Price }), () => Assert.AreEqual(expectedPrice.Tax, calculatedprice.Tax, "Tax {0} does not match the expected value {1}.", new object[] { calculatedprice.Tax, expectedPrice.Tax }) ); }
public void GetOder_ExistingOrder_ReturnsOrder() { var order = mRepository.GetById(ORDER_FIRST_SITE_ID1); CMSAssert.All( () => Assert.IsNotNull(order, "Order not found."), () => Assert.AreEqual(ORDER_FIRST_SITE_ID1, order.OrderID, "Incorrect order returned.") ); }
public void Equals_CommutativeProperty_SameResults() { var constraint1 = SizeConstraint.Size(100, 200); var constraint2 = SizeConstraint.Size(100, 200); CMSAssert.All( () => Assert.That(constraint1.Equals(constraint2), Is.True), () => Assert.That(constraint2.Equals(constraint1), Is.True)); }
public void GetProductVariants_ExistingSKUWithVariants_ReturnsAllVariants() { var variants = mRepository.GetByProductId(PARENT_SKU_WITHVARIANTS); CMSAssert.All( () => Assert.IsNotNull(variants, "Returned null for product with variants."), () => Assert.AreEqual(3, variants.Count(), "Returned incorrect number of variants.") ); }
public void GetShippingOption_DisabledShippingOption_ReturnsShippingOption() { var shippingOption = mRepository.GetById(DISABLED_SHIPPINGOPTION_ID); CMSAssert.All( () => Assert.IsNotNull(shippingOption, "Returned null for an existing disabled shipping option."), () => Assert.AreEqual(DISABLED_SHIPPINGOPTION_ID, shippingOption.ShippingOptionID, "Incorrect shipping option returned.") ); }
public void GetCustomerAddresses_WithAddresses_ReturnsAddresses() { var addresses = mRepository.GetByCustomerId(CUSTOMER_WITHADDRESS_ID); CMSAssert.All( () => Assert.IsNotNull(addresses, "Returned null instead of a collection of addresses."), () => Assert.AreEqual(2, addresses.Count(), "Wrong number of addresses returned.") ); }
public async Task AddToRoleAsync_UserIsNotInRole_UserRoleInfoCreated() { var user = new User(mMembershipFakeFactory.UserEnabledWithEmail); await mUserStore.AddToRoleAsync(user, MembershipFakeFactory.ROLE_MEMBER); CMSAssert.All( () => Assert.AreEqual(1, UserRoleInfoProvider.GetUserRoles().Count), () => Assert.IsNotNull(UserRoleInfoProvider.GetUserRoleInfo(user.Id, mMembershipFakeFactory.MemberRole.RoleID))); }
public void Size_ValidBothArguments_SetsWidthAndHeightProperties() { var constraint = SizeConstraint.Size(100, 200); CMSAssert.All( () => Assert.That(constraint.WidthComponent, Is.EqualTo(100)), () => Assert.That(constraint.HeightComponent, Is.EqualTo(200)), () => Assert.That(constraint.MaxWidthOrHeightComponent, Is.EqualTo(0))); }
public void GetProductVariant_ExistingEnabledVariant_ReturnsVariant() { var variant = mRepository.GetById(VARIANT_SKU_ID1); CMSAssert.All( () => Assert.IsNotNull(variant, "No object returned for an existing enabled variant."), () => Assert.AreEqual(VARIANT_SKU_ID1, variant.VariantSKUID) ); }
public void GetVariantOptionCategories_ExistingSKUWithoutCategories_ReturnsEmptyCollection() { var categories = mRepository.GetVariantOptionCategories(PARENT_SKU_WITHOUTVARIANTS); CMSAssert.All( () => Assert.IsNotNull(categories, "Returned null instead of an empty collection."), () => Assert.IsEmpty(categories, "Returned option categories for a product without variants.") ); }
public void GetVariantOptionCategories_NonExistentSKU_ReturnsEmptyCollection() { var categories = mRepository.GetVariantOptionCategories(NONEXISTENT_SKU_ID); CMSAssert.All( () => Assert.IsNotNull(categories, "Returned null instead of an empty collection."), () => Assert.IsEmpty(categories, "Returned option categories for non-existent SKU") ); }
public void GetProductVariants_ExistingSKUWithoutVariants_ReturnsEmptyCollection() { var variants = mRepository.GetByProductId(PARENT_SKU_WITHOUTVARIANTS); CMSAssert.All( () => Assert.IsNotNull(variants, "Returned null instead of an empty collection."), () => Assert.IsEmpty(variants, "Returned variants for a product without variant") ); }
public void GetProductVariants_NonExistentSKU_ReturnsEmptyCollection() { var variants = mRepository.GetByProductId(NONEXISTENT_SKU_ID); CMSAssert.All( () => Assert.IsNotNull(variants, "Returned null instead of an empty collection."), () => Assert.IsEmpty(variants, "Returned variants for a product without variant") ); }
public void Width_ValidArgument_SetsWidthComponentProperty() { var constraint = SizeConstraint.Width(100); CMSAssert.All( () => Assert.That(constraint.WidthComponent, Is.EqualTo(100)), () => Assert.That(constraint.HeightComponent, Is.EqualTo(0)), () => Assert.That(constraint.MaxWidthOrHeightComponent, Is.EqualTo(0))); }
public void GetCustomerOrders_NonExistingCustomer_ReturnsEmptyList() { var orders = mRepository.GetByCustomerId(NON_EXISTING_CUSTOMER_ID); CMSAssert.All( () => Assert.IsNotNull(orders), () => Assert.IsEmpty(orders, "Orders returned for non-existing customer.") ); }
public void Register_SingleCall_PreviewFilterRegistered() { PreviewGlobalFilters.Register(); CMSAssert.All( () => Assert.That(GlobalFilters.Filters.Count, Is.EqualTo(1)), () => Assert.That(GlobalFilters.Filters.First().Instance, Is.TypeOf(typeof(PreviewOutputCacheFilter))) ); }
public void NotEqualOperator_CommutativeProperty_SameResults() { var constraint1 = SizeConstraint.Size(100, 200); var constraint2 = SizeConstraint.Size(100, 200); CMSAssert.All( () => Assert.That(constraint1 != constraint2, Is.False), () => Assert.That(constraint2 != constraint1, Is.False)); }
public void GetCustomerOrders_ExistingCustomerWithoutTopNParameter_ReturnsAllOrdersFromCurrentSite() { var orders = mRepository.GetByCustomerId(CUSTOMER_ID); CMSAssert.All( () => Assert.IsNotNull(orders), () => Assert.IsNotEmpty(orders, "No orders found for customer."), () => Assert.AreEqual(2, orders.Count(), "Orders count is not 2 as expected.") ); }
public void Search_ValidSearchOptions_ReturnsNoData() { var searchResults = PageSearch(); var results = searchResults.Result; CMSAssert.All( // Test that results.Items is an empty collection, cannot be null. () => Assert.That(results.Items, Is.Empty), () => Assert.AreEqual(results.TotalNumberOfResults, 0)); }
public async Task RoleDeletion_OneRoleIsCreatedWithID_AfterDeletingRole_NoRoleInfoExists() { int idToBeDeleted = role.Id; await store.DeleteAsync(role); CMSAssert.All( () => Assert.AreNotEqual(0, idToBeDeleted), () => Assert.AreEqual(0, RoleInfoProvider.GetRoles().Count)); }
public void GetShippingOptions_ReturnsAllEnabledOptions() { var shippingOptions = mRepository.GetAllEnabled(); CMSAssert.All( () => Assert.IsNotNull(shippingOptions, "No shipping option returned."), () => Assert.IsNotEmpty(shippingOptions, "No enabled shipping options found."), () => Assert.AreEqual(2, shippingOptions.Count(), "Wrong number of shipping options returned.") ); }
public void GetPaymentMethod_GlobalPaymentMethod_GlobalEnabled_ReturnsPaymentMethod() { EnableGlobalMethods(true); var paymentMethod = mRepository.GetById(GLOBAL_PAYMENTMETHOD_ID); CMSAssert.All( () => Assert.IsNotNull(paymentMethod, "Returned null for an existing enabled global payment option."), () => Assert.AreEqual(GLOBAL_PAYMENTMETHOD_ID, paymentMethod.PaymentOptionID, "Incorrect payment option returned.") ); }
public async Task PasswordSignInAsync_IncorrectPassword_UserNotSignedIn(string userName, string password) { var user = UserInfoProvider.GetUserInfo(userName); var result = await mSignInManager.PasswordSignInAsync(user.UserName, "incorrectPassword", false, false); CMSAssert.All( () => Assert.AreEqual(SignInStatus.Failure, result), () => Assert.IsNull(mOwinContext.Authentication.AuthenticationResponseGrant)); }
public void AddItem_ContainsCorrectItem(int units) { var cart = CreateCartWithItem(Factory.SKUAvailable.SKUID, units); var item = cart.Items.FirstOrDefault(); CMSAssert.All( () => Assert.That(cart.Items.Count() == 1, "Wrong number of products in shopping cart", null), () => Assert.AreEqual(item.Name, Factory.SKUAvailable.SKUName, "Item name does not match", null), () => Assert.AreEqual(item.Units, units, "Invalid number of item units", null) ); }
public void SetAsPaid_OrderIsPaid() { var order = CreateOrderFromNewCart(); order.SetAsPaid(); CMSAssert.All( () => Assert.That(order.OriginalOrder.OrderIsPaid), () => Assert.That(order.IsPaid) ); }
public void UpdatePassword_PBKDF2PasswordHashMethod_PasswordCanBeVerified() { SettingsKeyInfoProvider.SetValue("CMSPasswordFormat", 0, "pbkdf2"); var user = new User(mMembershipFakeFactory.UserWithPassword); var result = manager.CallProtectedUpdatePassword(user, MembershipFakeFactory.TEST_PASSWORD); var passwordHash = ValidationHelper.GetString(UserInfoProvider.GetUserInfo(user.Id).GetValue("UserPassword"), string.Empty); CMSAssert.All(() => Assert.IsTrue(SecurityHelper.VerifyPBKDF2Hash(MembershipFakeFactory.TEST_PASSWORD, passwordHash)), () => Assert.IsTrue(manager.CallProtectedVerifyPassword(user, MembershipFakeFactory.TEST_PASSWORD))); }
public void UpdatePassword_VariousPasswordHashMethods_PasswordCanBeVerified(string hashMethod, string password) { SettingsKeyInfoProvider.SetValue("CMSPasswordFormat", 0, hashMethod); var user = new User(mMembershipFakeFactory.UserWithPassword); var result = manager.CallProtectedUpdatePassword(user, password); var passwordHash = UserInfoProvider.GetUserInfo(user.Id).GetValue("UserPassword"); CMSAssert.All(() => Assert.AreEqual(UserInfoProvider.GetPasswordHash(password, hashMethod, user.GUID.ToString()), passwordHash), () => Assert.IsTrue(manager.CallProtectedVerifyPassword(user, password))); }