Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsFalse(bool)

Here are the examples of the csharp api Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsFalse(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

476 Examples 7

19 Source : AffiliatesTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Affiliates_TestCreateAndFindAndDelete()
        {
            //Create API proxy
            var proxy = CreateApiProxy();

            //Create Affiliate
            var affiliate = new AffiliateDTO
            {
                StoreId = 1,
                DisplayName = "TestUserName" + DateTime.Now.ToString("ss"),
                Enabled = true,
                CommissionAmount = 50,
                ReferralId = "TestReferall" + DateTime.Now.ToString("ss")
            };
            var createResponse = proxy.AffiliatesCreate(affiliate);
            CheckErrors(createResponse);
            replacedert.IsFalse(createResponse.Content.Id == 0);

            //Find Affiliate
            var findResponse = proxy.AffiliatesFind(createResponse.Content.Id);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.DisplayName, findResponse.Content.DisplayName);
            replacedert.AreEqual(createResponse.Content.CommissionAmount, findResponse.Content.CommissionAmount);
            replacedert.AreEqual(createResponse.Content.Enabled, findResponse.Content.Enabled);
            replacedert.AreEqual(createResponse.Content.ReferralId, findResponse.Content.ReferralId);

            //Create Affiliate Referral
            var affiliateReferral = new AffiliateReferralDTO
            {
                AffiliateId = createResponse.Content.Id,
                ReferrerUrl = string.Empty,
                StoreId = 1,
                TimeOfReferralUtc = DateTime.UtcNow
            };
            var affiliateRefferalCreateResponse = proxy.AffiliateReferralsCreate(affiliateReferral);
            CheckErrors(affiliateRefferalCreateResponse);
            replacedert.IsFalse(affiliateRefferalCreateResponse.Content.Id == 0);

            //Find Affiliate Referral
            var findAffiliateReferralResponse = proxy.AffiliateReferralsFindForAffiliate(createResponse.Content.Id);
            CheckErrors(findAffiliateReferralResponse);
            replacedert.AreEqual(affiliateRefferalCreateResponse.Content.AffiliateId,
                findAffiliateReferralResponse.Content.First().AffiliateId);
            replacedert.AreEqual(affiliateRefferalCreateResponse.Content.StoreId,
                findAffiliateReferralResponse.Content.First().StoreId);

            //Update Affiliate
            createResponse.Content.CommissionAmount = 55;
            var updateResponse = proxy.AffiliatesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.CommissionAmount, updateResponse.Content.CommissionAmount);

            //Delete Affiliate
            var deleteResponse = proxy.AffiliatesDelete(createResponse.Content.Id);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : CategoriesTest.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Category_TestCreateAndFindAndDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Category
            var category = new CategoryDTO
            {
                StoreId = 1,
                Name = "Test Category",
                RewriteUrl = "test-category-from-unit-tests"
            };
            var createResponse = proxy.CategoriesCreate(category);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));


            //Find Category by Bvin
            var findResponse = proxy.CategoriesFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.Name, findResponse.Content.Name);
            replacedert.AreEqual(createResponse.Content.RewriteUrl, findResponse.Content.RewriteUrl);

            //Find Category by Slug
            var findBySlugResponse = proxy.CategoriesFindBySlug(createResponse.Content.RewriteUrl);
            CheckErrors(findBySlugResponse);
            replacedert.AreEqual(createResponse.Content.Name, findBySlugResponse.Content.Name);
            replacedert.AreEqual(createResponse.Content.RewriteUrl, findBySlugResponse.Content.RewriteUrl);

            //Delete Category by Bvin
            var deleteResponse = proxy.CategoriesDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : CategoriesTest.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Category_TestCreate()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Find Category by Slug.
            var resParent = proxy.CategoriesFindBySlug(TestConstants.TestCategorySlug);
            CheckErrors(resParent);

            //Create Category.
            var dto = new CategoryDTO
            {
                StoreId = 1,
                Name = "Test Category",
                ParentId = resParent.Content.Bvin
            };
            var resC = proxy.CategoriesCreate(dto);
            CheckErrors(resC);
            replacedert.IsFalse(string.IsNullOrEmpty(resC.Content.Bvin));
            replacedert.IsFalse(string.IsNullOrEmpty(resC.Content.RewriteUrl));
            replacedert.AreEqual(dto.Name, resC.Content.Name);

            //Delete Category.
            var resD = proxy.CategoriesDelete(resC.Content.Bvin);
            CheckErrors(resD);
            replacedert.IsTrue(resD.Content);
        }

19 Source : ManufacturersTest.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Manufacturers_TestCreateAndFindAndDelete()
        {
            //Create Manufacturer proxy
            var proxy = CreateApiProxy();

            //Create Manufacturer
            var vendorManufacture = new VendorManufacturerDTO
            {
                Address = new AddressDTO(),
                ContactType = VendorManufacturerTypeDTO.Vendor,
                DisplayName = "New Manufacturer",
                EmailAddress = "[email protected]",
                StoreId = 1
            };
            var createResponse = proxy.ManufacturerCreate(vendorManufacture);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Manufacturer
            var findResponse = proxy.ManufacturerFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.EmailAddress, findResponse.Content.EmailAddress);
            replacedert.AreEqual(createResponse.Content.DisplayName, findResponse.Content.DisplayName);

            //Update Manufacturer
            createResponse.Content.EmailAddress = "[email protected]";
            var updateResponse = proxy.ManufacturerUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.EmailAddress, updateResponse.Content.EmailAddress);

            //Delete Manufacturer
            var deleteResponse = proxy.ManufacturerDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : OrdersTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Order_CreateUpdateDeleteTransaction()
        {
            //Create API Proxy
            var proxy = CreateApiProxy();

            //Create Order.
            var order = new OrderDTO
            {
                StoreId = 1,
                Items = new List<LineItemDTO>
                {
                    new LineItemDTO
                    {
                        StoreId = 1,
                        ProductId = "fcb5f832-0f72-4722-bfd9-ec099051fc00"
                    },
                    new LineItemDTO
                    {
                        StoreId = 1,
                        ProductId = "d6895ee4-8118-4e51-905b-fc8edad5d711"
                    }
                }
            };
            var createResponse = proxy.OrdersCreate(order);
            CheckErrors(createResponse);

            //Create Order Transaction
            var orderTransaction = new OrderTransactionDTO
            {
                Action = OrderTransactionActionDTO.CashReceived,
                Amount = 50,
                Messages = "test transaction",
                OrderId = createResponse.Content.Bvin,
                OrderNumber = createResponse.Content.OrderNumber,
                StoreId = 1,
                TimeStampUtc = DateTime.UtcNow
            };
            var createTransactionResponse = proxy.OrderTransactionsCreate(orderTransaction);
            CheckErrors(createTransactionResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createTransactionResponse.Content.Id.ToString()));

            //Update Transaction
            createTransactionResponse.Content.Messages = createTransactionResponse.Content.Messages + "updated";
            var updateTransactionResponse = proxy.OrderTransactionsUpdate(createTransactionResponse.Content);
            CheckErrors(updateTransactionResponse);
            replacedert.AreEqual(createTransactionResponse.Content.Messages, updateTransactionResponse.Content.Messages);

            //Delete Transaction by Transaction unique identifier. 
            var deleteTransactionResponse = proxy.OrderTransactionsDelete(updateTransactionResponse.Content.Id);
            CheckErrors(deleteTransactionResponse);
            replacedert.IsTrue(deleteTransactionResponse.Content);

            //Delete Order
            var orderBvin = createResponse.Content.Bvin;
            var deleteResponse = proxy.OrdersDelete(orderBvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : PriceGroupTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void PriceGroups_TestCreateAndFindAndDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Price group.
            var priceGroup = new PriceGroupDTO
            {
                StoreId = 1,
                Name = "Test PriceGroup",
                AdjustmentAmount = 5,
                PricingType = PricingTypesDTO.AmountAboveCost
            };
            var createResponse = proxy.PriceGroupsCreate(priceGroup);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Price group by its unique identifer.
            var findResponse = proxy.PriceGroupsFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.Name, findResponse.Content.Name);
            replacedert.AreEqual(createResponse.Content.AdjustmentAmount, findResponse.Content.AdjustmentAmount);

            //Update Price group.
            priceGroup.AdjustmentAmount = 50;
            var updateResponse = proxy.PriceGroupsUpdate(priceGroup);
            CheckErrors(updateResponse);
            replacedert.AreEqual(priceGroup.AdjustmentAmount, updateResponse.Content.AdjustmentAmount);

            //Delete Price group.
            var deleteResponse = proxy.PriceGroupsDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductFilesTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        [Deploymenreplacedem(@"Data\ProductImage.jpg", "Data")]
        public void ProductFiles_CreateUpdateDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Product File.
            var productfile = new ProductFileDTO
            {
                FileName = "Test" + DateTime.Now.ToString("yyyyMMddHHmmss"),
                MaxDownloads = 5,
                ShortDescription = "My test file for product",
                ProductId = TestConstants.TestProductBvin,
                StoreId = 1,
                AvailableMinutes = 20
            };
            var createResponse = proxy.ProductFilesCreate(productfile);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Update product file.
            createResponse.Content.ShortDescription = createResponse.Content.ShortDescription + "updated";
            var updateResponse = proxy.ProductFilesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.ShortDescription, updateResponse.Content.ShortDescription);

            //Find product file.
            var findResponse = proxy.ProductFilesFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(updateResponse.Content.MaxDownloads, findResponse.Content.MaxDownloads);


            //Upload product file first part.
            var imagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data/ProductImage.jpg");
            var imageData = File.ReadAllBytes(imagePath);
            var firstPartData = new byte[imageData.Length/2];
            var secondPart = new byte[imageData.Length/2];
            Array.Copy(imageData, 0, firstPartData, 0, imageData.Length/2);
            Array.Copy(imageData, imageData.Length/2, firstPartData, 0, imageData.Length/2);
            var firstPartResponse = proxy.ProductFilesDataUploadFirstPart(findResponse.Content.Bvin, "ProductImage.jpg",
                "Test UPload", firstPartData);
            replacedert.IsTrue(firstPartResponse.Content);

            //Upload product file second part
            var secondPartResponse = proxy.ProductFilesDataUploadAdditionalPart(findResponse.Content.Bvin,
                "ProductImage.jpg", secondPart);
            replacedert.IsTrue(firstPartResponse.Content);

            //Add file to product.
            var addfileToProductResponse = proxy.ProductFilesAddToProduct(TestConstants.TestProductBvin,
                findResponse.Content.Bvin, 5, 10);
            replacedert.IsTrue(addfileToProductResponse.Content);

            //Find product files for Product
            var findforProductResponse = proxy.ProductFilesFindForProduct(TestConstants.TestProductBvin);
            CheckErrors(findforProductResponse);
            replacedert.IsTrue(findforProductResponse.Content.Count > 0);

            //Remove product files for Product
            var removefileToProductResponse = proxy.ProductFilesRemoveFromProduct(TestConstants.TestProductBvin,
                findResponse.Content.Bvin);
            replacedert.IsTrue(removefileToProductResponse.Content);

            //Delete product file
            var deleteResponse = proxy.ProductFilesDelete(findResponse.Content.Bvin);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductImageTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        [Deploymenreplacedem(@"Data\ProductImage.jpg", "Data")]
        public void ProductImages_CreateFindUpdateDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Product Image 
            var productImage = new ProductImageDTO
            {
                AlternateText = "test alternate",
                Caption = "test caption",
                FileName = "ProductImage.jpg",
                ProductId = TestConstants.TestProductBvin,
                StoreId = 1
            };

            //Create product image
            var imagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data/ProductImage.jpg");
            var imageData = File.ReadAllBytes(imagePath);
            var createResponse = proxy.ProductImagesCreate(productImage, imageData);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Product image
            var findResponse = proxy.ProductImagesFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.Caption, findResponse.Content.Caption);
            replacedert.AreEqual(createResponse.Content.FileName, findResponse.Content.FileName);

            //Find Product image
            var findByProductResponse = proxy.ProductImagesFindAllByProduct(productImage.ProductId);
            CheckErrors(findByProductResponse);

            //Update product image
            findResponse.Content.Caption = findResponse.Content.Caption + "updated";
            var updateResponse = proxy.ProductImagesUpdate(findResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(findResponse.Content.Caption, updateResponse.Content.Caption);

            //Upload product image
            var imageUplaodResponse = proxy.ProductImagesUpload(TestConstants.TestProductBvin,
                createResponse.Content.Bvin, "NewProductImage.jpg", imageData);
            CheckErrors(imageUplaodResponse);
            replacedert.IsTrue(imageUplaodResponse.Content);

            //Delete Product Image
            var deleteResponse = proxy.ProductImagesDelete(findResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductInventoryTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void ProductInventory_TestFindProductInventory()
        {
            //Create API Proxy
            var proxy = CreateApiProxy();

            //Create Product Inventory
            var productInventory = new ProductInventoryDTO
            {
                LowStockPoint = 5,
                OutOfStockPoint = 2,
                QuanreplacedyOnHand = 50,
                QuanreplacedyReserved = 4,
                ProductBvin = TestConstants.TestProductBvin
            };
            var createResponse = proxy.ProductInventoryCreate(productInventory);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Product Inventory
            var findResponse = proxy.ProductInventoryFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.LowStockPoint, findResponse.Content.LowStockPoint);
            replacedert.AreEqual(createResponse.Content.OutOfStockPoint, findResponse.Content.OutOfStockPoint);

            //Delete Product Inventory
            var deleteResponse = proxy.ProductInventoryDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductPropertiesTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void ProductProperty_CreateUpdateDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Product Property
            var productProperty = new ProductPropertyDTO
            {
                DisplayName = "TestCase Property",
                DefaultValue = "test",
                PropertyName = "TestCaseProperty",
                TypeCode = ProductPropertyTypeDTO.TextField,
                StoreId = 1
            };
            var createResponse = proxy.ProductPropertiesCreate(productProperty);
            CheckErrors(createResponse);
            replacedert.IsFalse(createResponse.Content.Id == 0);

            //Find Product Property
            var findResponse = proxy.ProductPropertiesFind(createResponse.Content.Id);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.DisplayName, findResponse.Content.DisplayName);
            replacedert.AreEqual(createResponse.Content.PropertyName, findResponse.Content.PropertyName);

            //Update product property
            createResponse.Content.DefaultValue = "testupdate";
            var updateResponse = proxy.ProductPropertiesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.DefaultValue, updateResponse.Content.DefaultValue);

            //Set Product properties value
            var setValueResponse = proxy.ProductPropertiesSetValueForProduct(updateResponse.Content.Id,
                TestConstants.TestProductBvin, "settestvalue", 0);
            CheckErrors(setValueResponse);
            replacedert.IsTrue(setValueResponse.Content);

            //Delete Product properties
            var deleteResponse = proxy.ProductPropertiesDelete(createResponse.Content.Id);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductReviewsTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void ProductReviews_CreateUpdateFindDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create product review
            var productReview = new ProductReviewDTO
            {
                Approved = true,
                ProductBvin = TestConstants.TestProductBvin,
                Rating = ProductReviewRatingDTO.FiveStars,
                UserID = "1",
                ReviewDateUtc = DateTime.UtcNow
            };
            var createResponse = proxy.ProductReviewsCreate(productReview);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Product review
            var findResponse = proxy.ProductReviewsFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.ProductBvin, findResponse.Content.ProductBvin);
            replacedert.AreEqual(createResponse.Content.Rating, findResponse.Content.Rating);

            //Update product review
            createResponse.Content.Rating = ProductReviewRatingDTO.TwoStars;
            var updateResponse = proxy.ProductReviewsUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.Rating, updateResponse.Content.Rating);

            //Delete product review
            var deleteResponse = proxy.ProductReviewsDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductsTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Product_SlugifyTest()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Test slug method
            var sluggedText = proxy.UtilitiesSlugify("abcXX??&&newtest");

            CheckErrors(sluggedText);

            replacedert.IsFalse(string.IsNullOrEmpty(sluggedText.Content));
        }

19 Source : ProductTypesTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void ProductTypes_TestCreateAndFindAndDelete()
        {
            //Create API Proxy
            var proxy = CreateApiProxy();

            //Create Product Type
            var productType = new ProductTypeDTO
            {
                ProductTypeName = "UnitTest Type",
                TemplateName = "TestTemplate",
                StoreId = 1,
                IsPermanent = true
            };
            var createResponse = proxy.ProductTypesCreate(productType);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Product Type by its unique identifier
            var findResponse = proxy.ProductTypesFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.ProductTypeName, findResponse.Content.ProductTypeName);
            replacedert.AreEqual(createResponse.Content.TemplateName, findResponse.Content.TemplateName);

            //Update Product Type
            createResponse.Content.IsPermanent = false;
            var updateResponse = proxy.ProductTypesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.IsPermanent, updateResponse.Content.IsPermanent);

            //Create Product Property
            var productProperty = new ProductPropertyDTO
            {
                DefaultValue = "5",
                DisplayName = "UnitTestTypeProperty",
                PropertyName = "UnitTestTypeProperty",
                StoreId = 1,
                TypeCode = ProductPropertyTypeDTO.TextField
            };
            var propertyCreateResponse = proxy.ProductPropertiesCreate(productProperty);
            CheckErrors(propertyCreateResponse);
            replacedert.IsFalse(propertyCreateResponse.Content.Id == 0);

            //Add Product Property to Product Type.
            var addPropertyResponse = proxy.ProductTypesAddProperty(createResponse.Content.Bvin,
                propertyCreateResponse.Content.Id, 1);
            replacedert.IsTrue(addPropertyResponse.Content);

            //Remove Product Property from Product Type.
            var removePropertyResponse = proxy.ProductTypesRemoveProperty(createResponse.Content.Bvin,
                propertyCreateResponse.Content.Id);
            replacedert.IsTrue(removePropertyResponse.Content);

            //Delete Product Type.
            var deleteResponse = proxy.ProductTypesDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ProductVolumeDiscountTests.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void ProductVolumeDiscount_CreateUpdateFindDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Product Volume Discount.
            var productVolumeDiscount = new ProductVolumeDiscountDTO
            {
                Amount = 50,
                DiscountType = ProductVolumeDiscountTypeDTO.Amount,
                ProductId = TestConstants.TestProductBvin,
                Qty = 5
            };
            var createResponse = proxy.ProductVolumeDiscountsCreate(productVolumeDiscount);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Product Volume Discount
            var findResponse = proxy.ProductVolumeDiscountsFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.DiscountType, findResponse.Content.DiscountType);
            replacedert.AreEqual(createResponse.Content.ProductId, findResponse.Content.ProductId);

            //Update Product Volume Discount
            createResponse.Content.Amount = 75;
            var updateResponse = proxy.ProductVolumeDiscountsUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.Amount, updateResponse.Content.Amount);

            //Delete Product Volume Discount.
            var deleteResponse = proxy.ProductVolumeDiscountsDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : TaxesTest.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Taxes_TestCreateAndFindAndDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Get list of all tax schedules
            var lstOfTaxSchedule = proxy.TaxSchedulesFindAll();

            //Create Tax
            var tax = new TaxDTO
            {
                Rate = 5,
                ShippingRate = 5,
                ApplyToShipping = true,
                StoreId = 1,
                PostalCode = "33401",
                CountryIsoAlpha3 = "US",
                TaxScheduleId = lstOfTaxSchedule.Content.First().Id
            };
            var createResponse = proxy.TaxesCreate(tax);
            CheckErrors(createResponse);
            replacedert.IsFalse(createResponse.Content.Id == 0);

            //Find Tax
            var findResponse = proxy.TaxesFind(createResponse.Content.Id);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.Rate, findResponse.Content.Rate);
            replacedert.AreEqual(createResponse.Content.ShippingRate, findResponse.Content.ShippingRate);

            //Update Tax
            createResponse.Content.ShippingRate = 10;
            createResponse.Content.Rate = 10;
            var updateResponse = proxy.TaxesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.ShippingRate, updateResponse.Content.ShippingRate);
            replacedert.AreEqual(createResponse.Content.Rate, updateResponse.Content.Rate);

            //Delete Tax
            var deleteResponse = proxy.TaxesDelete(createResponse.Content.Id);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : TaxSchedulesTest.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void TaxSchedules_TestCreateAndFindAndDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Tax Schedule.
            var taxSchedule = new TaxScheduleDTO
            {
                DefaultRate = 5,
                DefaultShippingRate = 5,
                Name = "TestCaseSchedule",
                StoreId = 1
            };
            var createResponse = proxy.TaxSchedulesCreate(taxSchedule);
            CheckErrors(createResponse);
            replacedert.IsFalse(createResponse.Content.Id == 0);

            //Find Tax Schedule.
            var findResponse = proxy.TaxSchedulesFind(createResponse.Content.Id);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.DefaultRate, findResponse.Content.DefaultRate);
            replacedert.AreEqual(createResponse.Content.Name, findResponse.Content.Name);

            //Update Tax Schedule.
            createResponse.Content.DefaultRate = 10;
            createResponse.Content.DefaultShippingRate = 10;
            var updateResponse = proxy.TaxSchedulesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.DefaultRate, updateResponse.Content.DefaultRate);
            replacedert.AreEqual(createResponse.Content.DefaultShippingRate, updateResponse.Content.DefaultShippingRate);

            //Delete Tax Schedule.
            var deleteResponse = proxy.TaxSchedulesDelete(createResponse.Content.Id);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : VendorsTest.cs
with MIT License
from HotcakesCommerce

[TestMethod]
        public void Vendors_TestCreateAndFindAndDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Vendor.
            var vendorManufacture = new VendorManufacturerDTO
            {
                Address = new AddressDTO(),
                ContactType = VendorManufacturerTypeDTO.Vendor,
                DisplayName = "New Vendor",
                EmailAddress = "[email protected]",
                StoreId = 1
            };
            var createResponse = proxy.VendorCreate(vendorManufacture);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Find Vendor
            var findResponse = proxy.VendorFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(createResponse.Content.EmailAddress, findResponse.Content.EmailAddress);
            replacedert.AreEqual(createResponse.Content.DisplayName, findResponse.Content.DisplayName);

            //Update Vendor
            createResponse.Content.EmailAddress = "[email protected]";
            var updateResponse = proxy.VendorUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.EmailAddress, updateResponse.Content.EmailAddress);

            //Delete Vendor
            var deleteResponse = proxy.VendorDelete(createResponse.Content.Bvin);
            CheckErrors(deleteResponse);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 Source : ElementAttribute.cs
with MIT License
from kfrajtak

[TestMethod]
        public void GetElementAttribute()
        {
            // NOTE: The attributes below are only a subset of supported attributes.
            //       Use inspect.exe to identify all available attributes of an element
            var element = alarmTabElement;

            // Fixed value string attributes
            replacedert.IsTrue(element.GetAttribute("Name").StartsWith("Alarm"));  // name is Alarm or Alarm tab on the older version
            replacedert.IsTrue(element.GetAttribute("LegacyName").StartsWith("Alarm")); // Shows as Legacy|Accessible.Name in inspect.exe
            replacedert.AreEqual(element.GetAttribute("AutomationId"), AlarmTabAutomationId);
            replacedert.AreEqual(element.GetAttribute("FrameworkId"), "XAML");
            replacedert.AreEqual(element.GetAttribute("ClreplacedName"), AlarmTabClreplacedName);

            // Fixed value boolean attributes
            replacedert.AreEqual(element.GetAttribute("IsEnabled"), "True");
            replacedert.AreEqual(element.GetAttribute("IsKeyboardFocusable"), "True");
            replacedert.AreEqual(element.GetAttribute("IsControlElement"), "True");

            // Arbitrary value attributes
            replacedert.IsTrue(Convert.ToInt32(element.GetAttribute("ProcessId")) > 0);
            replacedert.IsFalse(string.IsNullOrEmpty(element.GetAttribute("RuntimeId")));

            // Arbitrary value array attributes
            replacedert.IsFalse(string.IsNullOrEmpty(element.GetAttribute("ClickablePoint")));
            var boundingRectangle = element.GetAttribute("BoundingRectangle");
            replacedert.IsTrue(boundingRectangle.Contains("Top"));
            replacedert.IsTrue(boundingRectangle.Contains("Left"));
            replacedert.IsTrue(boundingRectangle.Contains("Width"));
            replacedert.IsTrue(boundingRectangle.Contains("Height"));

            // Pattern specific attribute that may be used along with element.Selected property etc.
            replacedert.AreEqual(element.GetAttribute("SelectionItem.IsSelected"), element.Selected.ToString());
            replacedert.AreEqual(element.GetAttribute("IsSelectionItemPatternAvailable"), "True");
            replacedert.AreEqual(element.GetAttribute("IsSelectionPatternAvailable"), "False");
        }

19 Source : Session.cs
with MIT License
from kfrajtak

[TestMethod]
        public void CreateSessionWithWorkingDirectoryAndArguments()
        {
            // Use File Explorer to get the temporary folder full path
            secondarySession = Utility.CreateNewSession(CommonTestSettings.ExplorerAppId);
            secondarySession.Keyboard.SendKeys(Keys.Alt + "d" + Keys.Alt + CommonTestSettings.TestFolderLocation + Keys.Enter);
            Thread.Sleep(TimeSpan.FromSeconds(2));
            secondarySession.Keyboard.SendKeys(Keys.Alt + "d" + Keys.Alt); // Select the address edit box using Alt + d shortcut
            string tempFolderFullPath = secondarySession.SwitchTo().ActiveElement().Text;
            replacedert.IsFalse(string.IsNullOrEmpty(tempFolderFullPath));

            // Launch Notepad with a filename argument and temporary folder path as the working directory
            AppiumOptions appiumOptions = new AppiumOptions();
            appiumOptions.AddAdditionalCapability("app", CommonTestSettings.NotepadAppId);
            appiumOptions.AddAdditionalCapability("appArguments", CommonTestSettings.TestFileName);
            appiumOptions.AddAdditionalCapability("appWorkingDir", tempFolderFullPath);
            session = new WindowsDriver<WindowsElement>(new Uri(CommonTestSettings.WindowsApplicationDriverUrl), appiumOptions);
            replacedert.IsNotNull(session);
            replacedert.IsNotNull(session.SessionId);

            try
            {
                // Verify that Notepad file not found dialog is displayed and save it
                var notFoundDialog = session.FindElementByName("Notepad");
                replacedert.AreEqual("ControlType.Window", notFoundDialog.TagName);
                notFoundDialog.FindElementByName("Yes").Click();
            }
            catch
            {
                // Verify that the window replacedle matches the filename if somehow a leftover test file exists from previous incomplete test run
                replacedert.IsTrue(session.replacedle.Contains(CommonTestSettings.TestFileName));
            }

            session.Quit();
            session = null;

            // Verify that the file is indeed saved in the working directory and delete it
            secondarySession.FindElementByAccessibilityId("SearchEditBox").SendKeys(CommonTestSettings.TestFileName + Keys.Enter);
            Thread.Sleep(TimeSpan.FromSeconds(2));
            WindowsElement testFileEntry = null;
            try
            {
                testFileEntry = secondarySession.FindElementByName("Items View").FindElementByName(CommonTestSettings.TestFileName + ".txt") as WindowsElement;  // In case extension is added automatically
            }
            catch
            {
                testFileEntry = secondarySession.FindElementByName("Items View").FindElementByName(CommonTestSettings.TestFileName) as WindowsElement;
            }

            replacedert.IsNotNull(testFileEntry);
            testFileEntry.Click();
            testFileEntry.SendKeys(Keys.Delete);
            Thread.Sleep(TimeSpan.FromSeconds(1));
        }

19 Source : Window.cs
with MIT License
from kfrajtak

[TestMethod]
        public void SwitchWindowsError_ForeignWindowHandle()
        {
            WindowsDriver<WindowsElement> mainSession = null;
            WindowsDriver<WindowsElement> foreignSession = null;

            try
            {
                mainSession = Utility.CreateNewSession(CommonTestSettings.CalculatorAppId);
                foreignSession = Utility.CreateNewSession(CommonTestSettings.AlarmClockAppId);
                replacedert.IsNotNull(mainSession.SessionId);
                replacedert.IsNotNull(foreignSession.SessionId);

                // Get a foreign window handle from a different application/process under foreignSession
                var foreignTopLevelWindow = foreignSession.CurrentWindowHandle;
                replacedert.IsFalse(string.IsNullOrEmpty(foreignTopLevelWindow));

                mainSession.SwitchTo().Window(foreignTopLevelWindow);
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual("Window handle does not belong to the same process/application", exception.Message);
            }
            finally
            {
                if (foreignSession != null)
                {
                    foreignSession.Quit();
                }

                if (foreignSession != null)
                {
                    mainSession.Quit();
                }
            }
        }

19 Source : EventToCommandTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestEnableAndDisableControlWithBoundParameter()
        {
            var trigger = new EventToCommand
            {
                MustToggleIsEnabledValue = true
            };

            var button = new Button();
            ((IAttachedObject)trigger).Attach(button);

            var vm = new CommandViewModel();
            var binding = new Binding
            {
                Source = vm.ToggledCommandWithParameter
            };

            var textBox = new TextBox
            {
                Text = "Hel"
            };

            var bindingParameter = new Binding
            {
                Source = textBox,
                Path = new PropertyPath("Text")
            };

            BindingOperations.SetBinding(trigger, EventToCommand.CommandProperty, binding);
            BindingOperations.SetBinding(trigger, EventToCommand.CommandParameterProperty, bindingParameter);

            replacedert.IsFalse(button.IsEnabled);
            trigger.Invoke();
            replacedert.IsFalse(vm.CommandExecuted);

            textBox.Text = "Hello world";

#if SILVERLIGHT
            // Invoking CommandManager from unit tests fails in WPF
            replacedert.IsTrue(button.IsEnabled);
            trigger.Invoke();
            replacedert.IsTrue(vm.CommandExecuted);
#endif
        }

19 Source : RelayCommandGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestCanExecuteWithInvalidParameterType()
        {
            var command = new RelayCommand<string>(
                p =>
                {
                },
                p => p == "CanExecute");

            var result = command.CanExecute(DateTime.Now);
            replacedert.IsFalse(result);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedPublicNamedMethod()
        {
            Reset();

            const int index = 99;
            const string parameter = "My parameter";

            _itemPublic = new PublicNestedTestClreplaced<string>(index);

            _action = _itemPublic.GetAction(WeakActionTestCase.PublicNamedMethod);

            _reference = new WeakReference(_itemPublic);
            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + PublicNestedTestClreplaced<string>.Public + index + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedPublicStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicNestedTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.PublicStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + PublicNestedTestClreplaced<string>.PublicStatic + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedInternalNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemPublic = new PublicNestedTestClreplaced<string>(index);
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.InternalNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + PublicNestedTestClreplaced<string>.Internal + index + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedInternalStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicNestedTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.InternalStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + PublicNestedTestClreplaced<string>.InternalStatic + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPublicNamedMethod()
        {
            Reset();

            const int index = 99;
            const string parameter = "My parameter";

            _itemInternal = new InternalNestedTestClreplaced<string>(index);

            _action = _itemInternal.GetAction(WeakActionTestCase.PublicNamedMethod);

            _reference = new WeakReference(_itemInternal);
            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalNestedTestClreplaced<string>.Expected + InternalNestedTestClreplaced<string>.Public + index + parameter,
                InternalNestedTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedInternalNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemInternal = new InternalNestedTestClreplaced<string>(index);
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.InternalNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalNestedTestClreplaced<string>.Expected + InternalNestedTestClreplaced<string>.Internal + index + parameter,
                InternalNestedTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedInternalStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemInternal = new InternalNestedTestClreplaced<string>();
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.InternalStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalNestedTestClreplaced<string>.Expected + InternalNestedTestClreplaced<string>.InternalStatic + parameter,
                InternalNestedTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : RelayCommandGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestReleasingTargetForExecuteGenericPrivate()
        {
            _tempoInstance = new TemporaryClreplaced();
            _reference = new WeakReference(_tempoInstance);

            _tempoInstance.CreateCommandGenericPrivate();

            replacedert.IsTrue(_reference.IsAlive);

            _tempoInstance = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : RelayCommandTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestReleasingTargetForExecute()
        {
            _tempoInstance = new TemporaryClreplaced();
            _reference = new WeakReference(_tempoInstance);

            TestCommand = new RelayCommand(
                _tempoInstance.SetContent);

            replacedert.IsTrue(_reference.IsAlive);

            _tempoInstance = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedPrivateNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemPublic = new PublicNestedTestClreplaced<string>(index);
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.PrivateNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + PublicNestedTestClreplaced<string>.Private + index + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedAnonymousMethod()
        {
            Reset();

            const int index = 99;
            const string parameter = "My parameter";

            _itemPublic = new PublicNestedTestClreplaced<string>(index);
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.AnonymousMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + index + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedAnonymousStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicNestedTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.AnonymousStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicNestedTestClreplaced<string>.Expected + parameter,
                PublicNestedTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPublicStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemInternal = new InternalNestedTestClreplaced<string>();
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.PublicStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalNestedTestClreplaced<string>.Expected + InternalNestedTestClreplaced<string>.PublicStatic + parameter,
                InternalNestedTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericNestedTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPrivateNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemInternal = new InternalNestedTestClreplaced<string>(index);
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.PrivateNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalNestedTestClreplaced<string>.Expected + InternalNestedTestClreplaced<string>.Private + index + parameter,
                InternalNestedTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedPublicStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.PublicStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + PublicTestClreplaced<string>.PublicStatic + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedInternalNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemPublic = new PublicTestClreplaced<string>(index);
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.InternalNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + PublicTestClreplaced<string>.Internal + index + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedInternalStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.InternalStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + PublicTestClreplaced<string>.InternalStatic + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedPrivateNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemPublic = new PublicTestClreplaced<string>(index);
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.PrivateNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + PublicTestClreplaced<string>.Private + index + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedPrivateStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.PrivateStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + PublicTestClreplaced<string>.PrivateStatic + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedAnonymousMethod()
        {
            Reset();

            const int index = 99;
            const string parameter = "My parameter";

            _itemPublic = new PublicTestClreplaced<string>(index);
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.AnonymousMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + index + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestPublicClreplacedAnonymousStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemPublic = new PublicTestClreplaced<string>();
            _reference = new WeakReference(_itemPublic);

            _action = _itemPublic.GetAction(WeakActionTestCase.AnonymousStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                PublicTestClreplaced<string>.Expected + parameter,
                PublicTestClreplaced<string>.Result);

            _itemPublic = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPublicNamedMethod()
        {
            Reset();

            const int index = 99;
            const string parameter = "My parameter";

            _itemInternal = new InternalTestClreplaced<string>(index);

            _action = _itemInternal.GetAction(WeakActionTestCase.PublicNamedMethod);

            _reference = new WeakReference(_itemInternal);
            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + InternalTestClreplaced<string>.Public + index + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPublicStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemInternal = new InternalTestClreplaced<string>();
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.PublicStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + InternalTestClreplaced<string>.PublicStatic + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedInternalNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemInternal = new InternalTestClreplaced<string>(index);
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.InternalNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + InternalTestClreplaced<string>.Internal + index + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedInternalStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemInternal = new InternalTestClreplaced<string>();
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.InternalStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + InternalTestClreplaced<string>.InternalStatic + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPrivateNamedMethod()
        {
            Reset();

            const string parameter = "My parameter";
            const int index = 99;

            _itemInternal = new InternalTestClreplaced<string>(index);
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.PrivateNamedMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + InternalTestClreplaced<string>.Private + index + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedPrivateStaticMethod()
        {
            Reset();

            const string parameter = "My parameter";

            _itemInternal = new InternalTestClreplaced<string>();
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.PrivateStaticMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + InternalTestClreplaced<string>.PrivateStatic + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

            replacedert.IsFalse(_reference.IsAlive);
        }

19 Source : WeakActionGenericTest.cs
with MIT License
from lbugnion

[TestMethod]
        public void TestInternalClreplacedAnonymousMethod()
        {
            Reset();

            const int index = 99;
            const string parameter = "My parameter";

            _itemInternal = new InternalTestClreplaced<string>(index);
            _reference = new WeakReference(_itemInternal);

            _action = _itemInternal.GetAction(WeakActionTestCase.AnonymousMethod);

            replacedert.IsTrue(_reference.IsAlive);
            replacedert.IsTrue(_action.IsAlive);

            _action.Execute(parameter);

            replacedert.AreEqual(
                InternalTestClreplaced<string>.Expected + index + parameter,
                InternalTestClreplaced<string>.Result);

            _itemInternal = null;
            GC.Collect();

#if SILVERLIGHT
            replacedert.IsTrue(_reference.IsAlive); // Anonymous, private and internal methods cannot be GCed
            _action = null;
            GC.Collect();
            replacedert.IsFalse(_reference.IsAlive);
#else
            replacedert.IsFalse(_reference.IsAlive);
#endif
        }

See More Examples