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

            shelf.AddOrder(order);

            Assert.False(shelf.ContainsOrder(Guid.NewGuid()));
        }
コード例 #2
0
        public void GetValue()
        {
            Order     order = new Order(Guid.NewGuid(), "test", Order.OrderTemp.Cold, 5.0f, 5.0f);
            ColdShelf shelf = new ColdShelf(15, new NormalDecayStrategy());

            shelf.AddOrder(order);

            Assert.Equal(shelf.GetValue(order.Id), order.Value);
        }
コード例 #3
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());
        }
コード例 #4
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);
        }