示例#1
0
        public void ProteinBenchmarkSlotIdentifier_Value_Test2()
        {
            var client = new ProteinBenchmarkSlotIdentifier("name", "path");

            Assert.AreEqual("name (path)", client.Value);
            Assert.IsFalse(client.AllSlots);
        }
        private void cboClients_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentSlotIdentifier  = (ProteinBenchmarkSlotIdentifier)cboClients.SelectedValue;
            picDeleteClient.Visible = !_currentSlotIdentifier.AllSlots;

            UpdateProjectListBoxBinding();
        }
示例#3
0
        public void ProteinBenchmarkSlotIdentifier_Value_Test1()
        {
            var client = new ProteinBenchmarkSlotIdentifier();

            Assert.AreEqual("All Slots", client.Value);
            Assert.IsTrue(client.AllSlots);
        }
示例#4
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test2()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier();
            var client2 = new object();

            // calls Object.Equals() override
            Assert.AreNotEqual(client1, client2);
        }
示例#5
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test13()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier("name", "path\\");
            var client2 = new ProteinBenchmarkSlotIdentifier("name2", "path\\");

            Assert.IsFalse(client1.Equals(client2));
            Assert.IsTrue(client1.CompareTo(client2) < 0);
        }
示例#6
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test11()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier("name", "path\\to\\folder\\");
            var client2 = new ProteinBenchmarkSlotIdentifier("name", "path/to/folder/");

            Assert.IsFalse(client1.Equals(client2));
            Assert.IsTrue(client1.CompareTo(client2) > 0);
        }
示例#7
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test3()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier();
            var client2 = new ProteinBenchmarkSlotIdentifier();

            Assert.IsTrue(client1.Equals(client2));
            Assert.IsTrue(client1.CompareTo(client2) == 0);
        }
示例#8
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test19()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier();

            Assert.IsFalse(null == client1);
            Assert.IsTrue(null != client1);
            //Assert.IsFalse(null < client1);
            //Assert.IsFalse(null > client1);
        }
示例#9
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test18()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier();

            Assert.IsFalse(client1 == null);
            Assert.IsTrue(client1 != null);
            //Assert.IsFalse(client1 < null);
            //Assert.IsFalse(client1 > null);
        }
示例#10
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test17()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier("name", "path");
            var client2 = new ProteinBenchmarkSlotIdentifier();

            Assert.IsFalse(client1 == client2);
            Assert.IsTrue(client1 != client2);
            Assert.IsFalse(client1 < client2);
            Assert.IsTrue(client1 > client2);
        }
示例#11
0
        public void UpdateBenchmarkDataTest()
        {
            // setup
            var benchmarkCollection = new ProteinBenchmarkService();
            var database            = MockRepository.GenerateMock <IUnitInfoDatabase>();
            var legacyClient        = new LegacyClient {
                BenchmarkService = benchmarkCollection, UnitInfoDatabase = database
            };

            var unitInfo1 = new UnitInfo();

            unitInfo1.OwningClientName = "Owner";
            unitInfo1.OwningClientPath = "Path";
            unitInfo1.ProjectID        = 2669;
            unitInfo1.ProjectRun       = 1;
            unitInfo1.ProjectClone     = 2;
            unitInfo1.ProjectGen       = 3;
            unitInfo1.FinishedTime     = new DateTime(2010, 1, 1);
            var currentUnitInfo = new UnitInfoModel {
                CurrentProtein = new Protein(), UnitInfoData = unitInfo1
            };

            var unitInfo1Clone = unitInfo1.DeepClone();

            unitInfo1Clone.FramesObserved = 4;
            unitInfo1Clone.SetUnitFrame(new UnitFrame {
                TimeOfFrame = TimeSpan.FromMinutes(0), FrameID = 0
            });
            unitInfo1Clone.SetUnitFrame(new UnitFrame {
                TimeOfFrame = TimeSpan.FromMinutes(5), FrameID = 1
            });
            unitInfo1Clone.SetUnitFrame(new UnitFrame {
                TimeOfFrame = TimeSpan.FromMinutes(10), FrameID = 2
            });
            unitInfo1Clone.SetUnitFrame(new UnitFrame {
                TimeOfFrame = TimeSpan.FromMinutes(15), FrameID = 3
            });
            var unitInfoLogic1 = new UnitInfoModel {
                CurrentProtein = new Protein(), UnitInfoData = unitInfo1Clone
            };

            var unitInfo2 = new UnitInfo();

            unitInfo2.OwningClientName = "Owner";
            unitInfo2.OwningClientPath = "Path";
            unitInfo2.ProjectID        = 2669;
            unitInfo2.ProjectRun       = 2;
            unitInfo2.ProjectClone     = 3;
            unitInfo2.ProjectGen       = 4;
            unitInfo2.FinishedTime     = new DateTime(2010, 1, 1);
            var unitInfoLogic2 = new UnitInfoModel {
                CurrentProtein = new Protein(), UnitInfoData = unitInfo2
            };

            var unitInfo3 = new UnitInfo();

            unitInfo3.OwningClientName = "Owner";
            unitInfo3.OwningClientPath = "Path";
            unitInfo3.ProjectID        = 2669;
            unitInfo3.ProjectRun       = 3;
            unitInfo3.ProjectClone     = 4;
            unitInfo3.ProjectGen       = 5;
            unitInfo3.FinishedTime     = new DateTime(2010, 1, 1);
            var unitInfoLogic3 = new UnitInfoModel {
                CurrentProtein = new Protein(), UnitInfoData = unitInfo3
            };

            var parsedUnits = new[] { unitInfoLogic1, unitInfoLogic2, unitInfoLogic3 };

            // arrange
            database.Stub(x => x.Connected).Return(true);
            database.Expect(x => x.Insert(null)).IgnoreArguments().Repeat.Times(3);

            var benchmarkClient = new ProteinBenchmarkSlotIdentifier("Owner", "Path");

            // assert before act
            Assert.AreEqual(false, benchmarkCollection.Contains(benchmarkClient));
            Assert.AreEqual(false, new List <int>(benchmarkCollection.GetBenchmarkProjects(benchmarkClient)).Contains(2669));
            Assert.IsNull(benchmarkCollection.GetBenchmark(currentUnitInfo.UnitInfoData));

            // act
            legacyClient.UpdateBenchmarkData(currentUnitInfo, parsedUnits, 2);

            // assert after act
            Assert.AreEqual(true, benchmarkCollection.Contains(benchmarkClient));
            Assert.AreEqual(true, new List <int>(benchmarkCollection.GetBenchmarkProjects(benchmarkClient)).Contains(2669));
            Assert.AreEqual(TimeSpan.FromMinutes(5), benchmarkCollection.GetBenchmark(currentUnitInfo.UnitInfoData).AverageFrameTime);

            database.VerifyAllExpectations();
        }
示例#12
0
        public void ProteinBenchmarkSlotIdentifier_GetHashCode_Test2()
        {
            var client = new ProteinBenchmarkSlotIdentifier("name", "path");

            Assert.AreEqual(-331019282, client.GetHashCode());
        }
示例#13
0
        public void ProteinBenchmarkSlotIdentifier_GetHashCode_Test1()
        {
            var client = new ProteinBenchmarkSlotIdentifier();

            Assert.AreEqual(0, client.GetHashCode());
        }
示例#14
0
        public void ProteinBenchmarkSlotIdentifier_Comparison_Test14()
        {
            var client1 = new ProteinBenchmarkSlotIdentifier();

            Assert.IsFalse(client1.Equals(null));
        }