public void Assignment1_TestBaseClass_ReturnTrue() { bool myresult = false; Clothing clothing = new Clothing(1234, "hats", "trendy hat", 6969, "hat"); if (clothing.GetType() == typeof(Clothing)) { myresult = true; } Assert.IsTrue(myresult, "My hat is of type clothing."); }
public void Assignment1_TestHatFactory_ReturnTrue() { bool myresult = false; string[] inputline = "9000, blue hat, hat, 88, hats".Split(","); Clothing hat = Assignment1.Services.Assignment1.ClothingFactory(inputline); if (hat.GetType() == typeof(Clothing)) { myresult = true; } Assert.IsTrue(myresult, "My hat is of type clothing."); }
public void Assignment1_TestShirtFactory_ReturnTrue() { bool myresult = false; string[] inputline = "848488, blue shirt, shirt, 88, shirts".Split(","); Clothing shirt = Assignment1.Services.Assignment1.ClothingFactory(inputline); if (shirt.GetType() == typeof(Shirts)) { myresult = true; } Assert.IsTrue(myresult, "My shirt is of type shirt."); }
public async Task OnCreateClothingAsyncServiceShouldCreateNewClothing() { IFormFile file = null; string filename = "SomeName"; Mock <ICloudinaryService> cloudinaryServiceMoq = new Mock <ICloudinaryService>(); var filemoq = cloudinaryServiceMoq.Setup(x => x.UploadDiagramImage(file, filename)).Returns(Task.Run(() => filename)); var context = InMemoryDatabase.GetDbContext(); string name = "Jacket"; string fabric = "Textile"; FormFile fileForDb = null; using (var stream = File.OpenRead("D:\\Ivteks72.App\\Ivteks72WebApp\\Ivteks72.App\\wwwroot\\lib\\pictures\\Location.png")) { fileForDb = new FormFile(stream, 0, stream.Length, null, Path.GetFileName(stream.Name)) { Headers = new HeaderDictionary(), ContentType = "application/pdf" }; } int quantity = 1; decimal pricePerUnit = 2.20m; var service = new ClothingService(context, cloudinaryServiceMoq.Object); var testClothing = new Clothing { ClothingDiagramURL = null, Fabric = fabric, Name = name, PricePerUnit = pricePerUnit, Quantity = quantity, }; var actualclothing = await service.CreateClothingAsync(name, fabric, fileForDb, quantity, pricePerUnit); Assert.NotNull(actualclothing); Assert.IsAssignableFrom(testClothing.GetType(), actualclothing); }
public VendorClothing GetVariantFromVendorClothings(List <VendorClothing> vendorClothings, Clothing clothingVariant) { // Get by type, color, and size VendorClothing vendorClothing = vendorClothings.FirstOrDefault(x => x.Clothing.GetType() == clothingVariant.GetType() && x.Clothing.Color == clothingVariant.Color && x.Clothing.Size == clothingVariant.Size); return(vendorClothing); }