public RefrigeratorTest() { _refrigerator.AddVegetable(tomato, 9); _refrigerator.AddVegetable(cabbage, 6); _refrigerator.SetMinimumQuantity(tomato, 5); _refrigerator.SetMinimumQuantity(cabbage, 4); }
public void RefrigeratorTestTwo() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); LadyFinger ladyFinger = new LadyFinger(); refrigerator.AddVegetable(tomato, 25); refrigerator.SetVegetableMinimumQuantity(tomato, 10); refrigerator.AddVegetable(cabbage, 10); refrigerator.SetVegetableMinimumQuantity(cabbage, 2); refrigerator.AddVegetable(ladyFinger, 7); refrigerator.SetVegetableMinimumQuantity(ladyFinger, 2); refrigerator.TakeOutVegetable(tomato, 20); refrigerator.TakeOutVegetable(cabbage, 7); var actualVegetableQuantity = refrigerator.CheckRefrigeratorContents(); var expectedVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 5)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(cabbage, 3)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(ladyFinger, 7)); Assert.Equal(expectedVegetableQuantity, actualVegetableQuantity); }
public void TestToCheckTheQuantityOfTomatoes() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 10); Assert.Equal(10, refrigerator.GetVegetableQuantity(tomato)); }
public void TestWhenQuantityIsSufficient() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); string message = refrigerator.TakeOutVegetable(tomato, 2); Assert.Equal(8, refrigerator.GetVegetableQuantity(tomato)); }
public void TestWhenQuantityReachesMinimumLimitAndOrderAutomaticallyPlaced() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); string message = refrigerator.TakeOutVegetable(tomato, 10); Assert.Equal(5, refrigerator.GetVegetableQuantity(tomato)); }
public void TestWhenQuantityIsSufficientNotifyUser() { Refrigerator refrigerator = new Refrigerator(); NotificationFactory notificationFactory = new NotificationFactory(); INotificationManager notificationManager = notificationFactory.GetNotificationType("email"); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); Assert.Equal(notificationManager.NotifySufficientQuantity(), refrigerator.TakeOutVegetable(tomato, 8)); }
public void TestWhenQuantityReachesMinimumLimitAndOrderPlacedNotifyUser() { Refrigerator refrigerator = new Refrigerator(); NotificationFactory notificationFactory = new NotificationFactory(); INotificationManager notificationManager = notificationFactory.GetNotificationType("email"); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); Assert.Equal(notificationManager.NotifyMinimumValueReached() + "." + notificationManager.NotifyOrderPlacedStatus(), refrigerator.TakeOutVegetable(tomato, 10)); }
public void TestVegetableQuantity() { Refrigerator refrigerator = new Refrigerator(); Cabbage cabbage = new Cabbage(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(cabbage, 10); refrigerator.AddVegetable(tomato, 20); var expectedVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(cabbage, 10)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 20)); var actualVegetableQuantity = refrigerator.GetVegetableQuantity(); Assert.Equal(expectedVegetableQuantity.OrderBy(x => x.Key.Name).ToList(), actualVegetableQuantity.OrderBy(x => x.Key.Name).ToList()); }
public void TestInsufficiencyNotification() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(tomato, 20); refrigerator.SetMinimumQuantity(tomato, 8); refrigerator.TakeOutVegetable(tomato, 15); Assert.Equal("Sent notification to refrigerator", refrigerator.SendNotification()); }
public void AddVegetableToEmptyTrayTest() { var refrigerator = new Refrigerator(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 4); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 4) }; var actual = refrigerator.GetVegetableQuantity(); Assert.Equal(expected, actual); }
public void TestInsufficientVegetableQuantity() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(tomato, 20); refrigerator.SetMinimumQuantity(tomato, 8); refrigerator.TakeOutVegetable(tomato, 15); var expectedInsufficientVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedInsufficientVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 3)); var actualInsufficientVegetableQuantity = refrigerator.GetAllInsufficientVegetables(); Assert.Equal(expectedInsufficientVegetableQuantity.OrderBy(x => x.Key.Name), actualInsufficientVegetableQuantity.OrderBy(x => x.Key.Name)); }
public void TrackQuantityTest() { var refrigerator = new Refrigerator(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 5); refrigerator.SetMinimumVegetableQuantity(tomato, 7); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 5) }; var actual = refrigerator.TrackQuantity(); Assert.Equal(expected, actual); }
public void TakeOutVegetableFromTrayTest() { var refrigerator = new Refrigerator(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 5); //refrigerator.SetMinimumVegetableQuantity(new Tomato(), 2); refrigerator.TakeOutVegetable(tomato, 3); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 2) }; var actual = refrigerator.GetVegetableQuantity(); Assert.Equal(expected, actual); }
public void PlaceOrderTest() { var refrigerator = new Refrigerator(); var tracker = new VegetableTracker(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 5); refrigerator.SetMinimumVegetableQuantity(tomato, 4); refrigerator.SetMaximumRefillLimit(tomato, 10); tracker.PlaceOrder(refrigerator); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 5) }; var actual = refrigerator.GetVegetableQuantity(); Assert.Equal(expected, actual); }