示例#1
0
        public void AddOrder()
        {
            Order     order = new Order(Guid.NewGuid(), "test", Order.OrderTemp.Cold, 5.0f, 5.0f);
            ColdShelf shelf = new ColdShelf(15, new NormalDecayStrategy());

            Assert.Empty(shelf.GetOrders());

            shelf.AddOrder(order);

            Assert.NotEmpty(shelf.GetOrders());
        }
示例#2
0
        public void UpdateValueAllOrders()
        {
            Order     order = new Order(Guid.NewGuid(), "test", Order.OrderTemp.Cold, 5.0f, 1.0f);
            ColdShelf shelf = new ColdShelf(15, new NormalDecayStrategy());

            shelf.AddOrder(order);

            Assert.Single(shelf.GetOrders().ToList());

            int timeStep = 1;

            float newValue = new NormalDecayStrategy().CalculateValue(order.Value, order.DecayRate, timeStep);

            shelf.UpdateValueAllOrders(timeStep);

            Assert.Equal(order.Value, newValue);
        }