public void TestBuildBasicService() { #region Service and Worker Team var TestTeamLeader = new TeamLeader(TestLeaderSalary); var TestWorker1 = new Worker(TestWorkerSalary); #endregion #region ServiceBase TestBasicService = TestService.BuildService("Basic") as ServiceBase; TestTeamLeader.AddWorker(TestWorker1); TestBasicService.Team = TestTeamLeader; #endregion #region Asserts: Control vars var TestPoison = TestBasicService.Poison; var TestAnimal = TestBasicService.Animal; var TestSimpleMask = TestBasicService.Assets.Where(x => x.GetType() == typeof(SimpleMask)).Single(); var TestFinalPrice = TestTeamLeader.Price + TestPoison.Price + TestSimpleMask.Price; #endregion #region Asserts Assert.AreEqual(typeof(Rat), TestAnimal.GetType(), "Different Animal types!"); Assert.AreEqual(typeof(Arsenic), TestPoison.GetType(), "Different Poison types!"); Assert.AreEqual(TestPoison, TestBasicService.Assets.Where(x => x.Equals(TestBasicService.Poison)).SingleOrDefault(), "Different Poison instances!"); Assert.AreEqual(typeof(SimpleMask), TestSimpleMask.GetType(), "No SimpleMask found!"); Assert.AreEqual(20, TestSimpleMask.Price, "Different SimpleMask prices!"); Assert.AreEqual(2, TestPoison.Price, "Different Poison prices!"); Assert.AreEqual(TestFinalPrice, TestBasicService.Price, "Service price is different!"); #endregion }
public void TestBuildBasicService() { #region Service and Worker Team var TestTeamLeader = new TeamLeader(TestLeaderSalary); var TestWorker1 = new Worker(TestWorkerSalary); #endregion #region ServiceBase TestBasicService = TestService.BuildService("Basic") as ServiceBase; TestTeamLeader.AddWorker(TestWorker1); TestBasicService.Team = TestTeamLeader; #endregion #region Asserts: Control vars var TestPoison = TestBasicService.Poison; var TestAnimal = TestBasicService.Animal; var TestProtectionSuite = TestBasicService.Assets.Where(x => x.GetType() == typeof(ProtectionSuite)).Single(); var TestIsolatedMask = TestBasicService.Assets.Where(x => x.GetType() == typeof(IsolatedMask)).Single(); var TestPoisonDiffuser = TestBasicService.Assets.Where(x => x.GetType() == typeof(PoisonDiffuser)).Single(); var TestBleach = TestBasicService.Assets.Where(x => x.GetType() == typeof(Bleach)).Single(); var TestFinalPrice = TestTeamLeader.Price + TestPoison.Price + TestProtectionSuite.Price + TestIsolatedMask.Price + TestPoisonDiffuser.Price + TestBleach.Price; #endregion #region Asserts Assert.AreEqual(typeof(Flea), TestAnimal.GetType(), "Different Animal types!"); Assert.AreEqual(typeof(Cyanide), TestPoison.GetType(), "Different Poison types!"); Assert.AreEqual(TestPoison, TestBasicService.Assets.Where(x => x.Equals(TestBasicService.Poison)).SingleOrDefault(), "Different Poison instances!"); Assert.AreEqual(typeof(ProtectionSuite), TestProtectionSuite.GetType(), "No ProtectionSuite found!"); Assert.AreEqual(typeof(IsolatedMask), TestIsolatedMask.GetType(), "No IsolatedMask found!"); Assert.AreEqual(typeof(PoisonDiffuser), TestPoisonDiffuser.GetType(), "No PoisonDiffuser found!"); Assert.AreEqual(500, TestProtectionSuite.Price, "Different ProtectionSuite prices!"); Assert.AreEqual(20, TestIsolatedMask.Price, "Different IsolatedMask prices!"); Assert.AreEqual(50, TestPoisonDiffuser.Price, "Different PoisonDiffuser prices!"); Assert.AreEqual(60, TestPoison.Price, "Different Poison prices!"); Assert.AreEqual(400, TestBleach.Price, "Different Bleach prices!"); Assert.AreEqual(TestFinalPrice, TestBasicService.Price, "Service price is different!"); #endregion }
public void TestBuildBasicService() { #region Service and Worker Team var TestTeamLeader = new TeamLeader(TestLeaderSalary); var TestWorker1 = new Worker(TestWorkerSalary); var TestWorker2 = new Worker(TestWorkerSalary); #endregion #region ServiceBase TestBasicService = TestService.BuildService("Basic") as ServiceBase; TestTeamLeader.AddWorker(TestWorker1); TestTeamLeader.AddWorker(TestWorker2); TestBasicService.Team = TestTeamLeader; #endregion #region Asserts: Control vars var TestPoison = TestBasicService.Poison; var TestAnimal = TestBasicService.Animal; var TestProtectionSuites = TestBasicService.Assets.Where(x => x.GetNombreRecurso().Equals("ProtectionSuite")); var TestSimpleMasks = TestBasicService.Assets.Where(x => x.GetNombreRecurso().Equals("SimpleMask")); var TestFinalPrice = TestTeamLeader.Price + TestPoison.Price + TestProtectionSuites.Sum(x => x.GetPrecioRecurso()) + TestSimpleMasks.Sum(x => x.GetPrecioRecurso()); #endregion #region Asserts Assert.AreEqual(typeof(Cockroach), TestAnimal.GetType(), "Different Animal types!"); Assert.AreEqual(typeof(Strychnine), TestPoison.GetType(), "Different Poison types!"); Assert.AreEqual(TestPoison, TestBasicService.Assets.Where(x => x.Equals(TestBasicService.Poison)).SingleOrDefault(), "Different Poison instances!"); Assert.AreEqual(2, TestProtectionSuites.Count(), "Not enough ProtectionSuites found!"); Assert.AreEqual(2, TestSimpleMasks.Count(), "Not enough SimpleMasks found!"); Assert.AreEqual(500, TestProtectionSuites[0].Price, "Different ProtectionSuite prices!"); Assert.AreEqual(500, TestProtectionSuites[1].Price, "Different ProtectionSuite prices!"); Assert.AreEqual(20, TestSimpleMasks[0].Price, "Different SimpleMask prices!"); Assert.AreEqual(20, TestSimpleMasks[1].Price, "Different SimpleMask prices!"); Assert.AreEqual(10, TestPoison.Price, "Different Poison prices!"); Assert.AreEqual(TestFinalPrice, TestBasicService.Price, "Service price is different!"); #endregion }