Пример #1
0
        public void RemoveRepTypeTestSalesRepTypeNotInDictionary()
        {
            Core         target = new Core();
            SalesRepType type   = new SalesRepType("Test");

            target.RemoveRepType(type);
        }
Пример #2
0
        public void RemoveRepTypeTestNullRepType()
        {
            Core         target = new Core();
            SalesRepType type   = null;

            target.RemoveRepType(type);
        }
        public void SalesRepTypeConstructorTest()
        {
            string       typeName = "Test";
            SalesRepType target   = new SalesRepType(typeName);

            Assert.IsInstanceOfType(target, typeof(SalesRepType));
        }
        public void SalesRepresentativeConstructorTest()
        {
            SalesRepType        repType = new SalesRepType("Test");
            SalesRepresentative target  = new SalesRepresentative(repType);

            Assert.IsInstanceOfType(target, typeof(SalesRepresentative));
        }
Пример #5
0
        public void RemoveRepTypeHandleTestNullProductType()
        {
            Core         target   = new Core();
            SalesRepType repType  = new SalesRepType("Test");
            ProductType  toRemove = null;

            target.RemoveRepTypeHandle(repType, toRemove);
        }
Пример #6
0
        public void AddRepTypeHandleTestNullSalesRepType()
        {
            Core         target   = new Core();
            SalesRepType repType  = null;
            ProductType  toHandle = new ProductType("Test", 0.1, 0.1);

            target.AddRepTypeHandle(repType, toHandle);
        }
Пример #7
0
        public void AddRepTypeHandleTestRepTypeNotInDictionary()
        {
            Core         target   = new Core();
            SalesRepType repType  = new SalesRepType("Test");
            ProductType  toHandle = new ProductType("Test", 0.1, 0.1);

            //target.RepNums.Add(repType, 1); // Dont add to dictionary
            target.AddRepTypeHandle(repType, toHandle);
        }
Пример #8
0
        public void RemoveRepTypeTest()
        {
            Core         target = new Core();
            SalesRepType type   = new SalesRepType("Test");

            target.RepNums.Add(type, 1);
            target.RemoveRepType(type);
            Assert.AreEqual(0, target.RepNums.Count);
        }
Пример #9
0
        public void RemoveRepTypeHandleTestSalesRepTypeNotInDictionary()
        {
            Core         target  = new Core();
            SalesRepType repType = new SalesRepType("Test");
            //Dont add the reptype to the dictionary
            ProductType toRemove = new ProductType("Test", 0.1, 0.1);

            target.RemoveRepTypeHandle(repType, toRemove);
        }
Пример #10
0
        public void RemoveRepTypeHandleTestProductTypeNotInHandlesList()
        {
            Core         target  = new Core();
            SalesRepType repType = new SalesRepType("Test");

            target.RepNums.Add(repType, 1);
            ProductType toRemove = new ProductType("Dave", 0.1, 0.1);

            target.RemoveRepTypeHandle(repType, toRemove);
        }
        public void ToStringTest()
        {
            string       typeName = "Test";
            SalesRepType target   = new SalesRepType(typeName);
            string       expected = "Type Name: Test, Handles:";
            string       actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
Пример #12
0
        public void AddRepTypeHandleTestNullProductType()
        {
            Core         target  = new Core();
            SalesRepType repType = new SalesRepType("Test");

            target.RepNums.Add(repType, 1);
            ProductType toHandle = null;

            target.AddRepTypeHandle(repType, toHandle);
        }
        public void RemoveRepresentativeTestNotInDictionary()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 2);
            SalesForceManager   target = new SalesForceManager(numberOfReps);
            SalesRepresentative representativeToRemove = new SalesRepresentative(new SalesRepType("James"));

            target.RemoveRepresentative(representativeToRemove);
        }
        public void AddSalesRepresentativeTestNotInDictionary()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 1);
            SalesRepType        notInDict      = new SalesRepType("Hello");
            SalesForceManager   target         = new SalesForceManager(numberOfReps);
            SalesRepresentative representative = new SalesRepresentative(notInDict);

            target.AddSalesRepresentative(representative);
        }
        public void RepresentativesOfTypeTestNotInDictionary()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 2);
            SalesForceManager target  = new SalesForceManager(numberOfReps);
            SalesRepType      repType = new SalesRepType("Dave");
            int actual;

            actual = target.RepresentativesOfType(repType);
        }
Пример #16
0
        public void AddRepTypeHandleTest()
        {
            Core         target   = new Core();
            SalesRepType repType  = new SalesRepType("Test");
            ProductType  toHandle = new ProductType("Test", 0.1, 0.1);

            target.RepNums.Add(repType, 1);
            target.AddRepTypeHandle(repType, toHandle);
            List <SalesRepType> keys = new List <SalesRepType>(target.RepNums.Keys);

            Assert.AreEqual(toHandle, keys[0].Handles[0]);
        }
Пример #17
0
        public void RemoveRepTypeHandleTest()
        {
            Core         target   = new Core();
            SalesRepType repType  = new SalesRepType("Test");
            ProductType  toRemove = new ProductType("Test", 0.1, 0.1);

            repType.Handles.Add(toRemove);
            target.RepNums.Add(repType, 1);
            target.RemoveRepTypeHandle(repType, toRemove);

            Assert.AreEqual(0, repType.Handles.Count);
        }
        public void GetFreeSalesRepTestNullRepType()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 1);
            SalesForceManager_Accessor target = new SalesForceManager_Accessor(numberOfReps);
            SalesRepType        repType       = null;
            SalesRepresentative expected      = target.SalesForce[repType][0];
            SalesRepresentative actual;

            actual = target.GetFreeSalesRep(repType);
        }
        public void RemoveRepresentativeTest()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 2);
            SalesForceManager   target = new SalesForceManager(numberOfReps);
            SalesRepresentative representativeToRemove = target.SalesForce[srt][0];

            target.RemoveRepresentative(representativeToRemove);

            Assert.AreEqual(1, target.SalesForce[srt].Count);
        }
        public void AddSalesRepresentativeTestNullRepresentative()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 1);
            SalesForceManager   target         = new SalesForceManager(numberOfReps);
            SalesRepresentative representative = null;

            target.AddSalesRepresentative(representative);

            Assert.AreEqual(representative, target.SalesForce[srt][1]);
        }
        public void GetFreeSalesRepTestTypeNotInDictionary()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 1);
            SalesRepType sType = new SalesRepType("Dave");
            SalesForceManager_Accessor target = new SalesForceManager_Accessor(numberOfReps);
            SalesRepType        repType       = sType;
            SalesRepresentative actual;

            actual = target.GetFreeSalesRep(repType);
        }
        public void RepresentativesBusyTestNotInDictionary()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 2);
            SalesForceManager target = new SalesForceManager(numberOfReps);

            target.SalesForce[srt][0].CurrentlyProcessing = new Call((uint)1);
            SalesRepType repType = new SalesRepType("Dave");
            int          actual;

            actual = target.RepresentativesBusy(repType);
        }
        public void RepresentativesOfTypeTest()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 2);
            SalesForceManager target  = new SalesForceManager(numberOfReps);
            SalesRepType      repType = srt;
            int expected = 2;
            int actual;

            actual = target.RepresentativesOfType(repType);
            Assert.AreEqual(expected, actual);
        }
        public void GetRepresentativeForProductTypeTest()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt   = new SalesRepType("Test");
            ProductType  ptype = new ProductType("Test", 0.1, 0.1);

            srt.Handles.Add(ptype);
            numberOfReps.Add(srt, 1);
            SalesForceManager   target   = new SalesForceManager(numberOfReps);
            SalesRepresentative expected = target.SalesForce[srt][0];
            SalesRepresentative actual;

            actual = target.GetRepresentativeForProductType(ptype);
            Assert.AreEqual(expected, actual);
        }
        public void RepresentativesBusyTest()
        {
            Dictionary <SalesRepType, int> numberOfReps = new Dictionary <SalesRepType, int>();
            SalesRepType srt = new SalesRepType("Test");

            numberOfReps.Add(srt, 2);
            SalesForceManager target = new SalesForceManager(numberOfReps);

            target.SalesForce[srt][0].CurrentlyProcessing = new Call((uint)1);
            SalesRepType repType  = srt;
            int          expected = 1;
            int          actual;

            actual = target.RepresentativesBusy(repType);
            Assert.AreEqual(expected, actual);
        }
Пример #26
0
        public void IsSimulationValidTestValid()
        {
            Core         target   = new Core();
            bool         expected = true;
            SalesRepType srt      = new SalesRepType("Test");

            target.RepNums.Add(srt, 1);
            target.ProductTypes.Add(new ProductType("Test", 0.1, 1));
            List <SalesRepType> keys = new List <SalesRepType>(target.RepNums.Keys);

            keys[0].Handles.Add(target.ProductTypes[0]);
            bool actual;

            actual = target.IsSimulationValid();
            Assert.AreEqual(expected, actual);
        }
Пример #27
0
        public void GetCallForRepTypeTestNullRepType()
        {
            int                maxQueueLength = 10;
            ProductType        pt             = new ProductType("Test", 0.1, 0.1);
            List <ProductType> productTypes   = new List <ProductType> {
                pt
            };
            bool         singleQueueLength = false;
            QueueManager target            = new QueueManager(maxQueueLength, productTypes, singleQueueLength);
            SalesRepType repType           = null;
            Call         newCall           = new Call((uint)1);

            newCall.ProductType = pt;
            target.AddToQueue(newCall);
            Call expected = newCall;
            Call actual;

            actual = target.GetCallForRepType(repType);
        }
        public void GetProcessableProductTypesTest()
        {
            SalesRepType       repType  = new SalesRepType("Test");
            List <ProductType> expected = new List <ProductType>();
            ProductType        pt1      = new ProductType("Test1", 0.1, 0.1);
            ProductType        pt2      = new ProductType("Test2", 0.1, 0.1);

            expected.Add(pt1);
            expected.Add(pt2);
            repType.Handles.Add(pt1);
            repType.Handles.Add(pt2);

            SalesRepresentative target = new SalesRepresentative(repType);

            List <ProductType> actual;

            actual = target.GetProcessableProductTypes();

            for (int i = 0; i < expected.Count; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
 public void SalesRepTypeConstructorTestEmptyString()
 {
     string       typeName = string.Empty;
     SalesRepType target   = new SalesRepType(typeName);
 }
 public void SalesRepresentativeConstructorTestNullRepType()
 {
     SalesRepType        repType = null;
     SalesRepresentative target  = new SalesRepresentative(repType);
 }