public void AddingMaterialToMagazine_PropertyCongiguredData_MagazineStateUpdated() { magazineManager.ClearMagazines(); magazineManager.RegisterMaterialWithinMagazine(Magazine.From("Test Magazine"), MaterialQuantity.From(new Material("MaterialID", "Test Material"), 50)); var contentOfMagazines = magazineManager.List(); Assert.NotEmpty(contentOfMagazines); }
public void AddingMaterialToMagazine_ClearingMagazineCalled_EmptyListRetunred() { magazineManager.ClearMagazines(); magazineManager.RegisterMaterialWithinMagazine(Magazine.From("Test Magazine"), MaterialQuantity.From(new Material("MaterialID", "Test Material"), 50)); var contentOfMagazines = magazineManager.List(); magazineManager.ClearMagazines(); Assert.Empty(contentOfMagazines); }
public void InstiatingMaterialTwice_NonNegativeQuantityProvided_SumOfMaterialCorrect() { var material = new Material("MaterialId", "MaterialName"); var magazineOne = Magazine.From("MagazineName1"); var createdMaterialQuantity10 = MaterialQuantity.From(material, 10); magazineManager.ClearMagazines(); magazineManager.RegisterMaterialWithinMagazine(magazineOne, createdMaterialQuantity10); var createdMaterialQuantity90 = MaterialQuantity.From(material, 90); magazineManager.RegisterMaterialWithinMagazine(magazineOne, createdMaterialQuantity90); Assert.Equal(100, magazineOne.TotalInMagazine()); }
public static (Magazine, int) ParseMaterialWithQuantity(string input) { var magazineStorage = input.Split(","); return(Magazine.From(magazineStorage[0]), int.Parse(magazineStorage[1])); }