public void Generate_on_textColor_Yellow_should_contains_Yellow_pixel()
 {
     var bitmap = generator.Generate();
     var pixels = new Collection<Color>();
     for (int i = 1; i < bitmap.Width; i++)
         for (int j = 1; j < bitmap.Height; j++)
         {
             pixels.Add(bitmap.GetPixel(i,j));
         }
     CollectionAssert.Contains(pixels, Color.FromArgb(255, 255, 255, 0));
 }
        public void TestInitialize()
        {
            BrowserStateManager.RefreshState();
            HomePageHelper.OpenSandboxPage();
            TourHelper.DeleteToursIfExist("webdriverTour");

            #region create timeline

            _newTimeline = new Timeline
            {
                FromYear = -6061670000,
                ToYear = -5808809999,
                Title = "WebDriverApiTitle"
            };
            Guid newTimelineId = ApiHelper.CreateTimelineByApi(_newTimeline);
            _newTimeline.Id = newTimelineId;

            #endregion

            #region create exhibit

            var contentItems = new Collection<ContentItem>();
            var contentItem = new ContentItem() { Title = "WebDriverApi", MediaType = "image", Uri = @"http://yandex.st/www/1.609/yaru/i/logo.png", Caption = "", Order = 0, Attribution = "", MediaSource = "" };
            contentItems.Add(contentItem);

            _newExhibit = new Exhibit()
            {
                Timeline_ID = newTimelineId,
                Title = "WebDriverApiExhibit",
                Year = -8596430000,
                ContentItems = contentItems
            };
            _newExhibit.Id = new Guid(ApiHelper.CreateExhibitByApi(_newExhibit).ExhibitId);

            #endregion

            #region init new tour

            _newTour = new Tour();
            _newTour.Name = "webdriverTour";
            _newTour.Description = "webdriver description";
            Bookmark exhibitBookmark = new Bookmark { Name = "WebDriverApiExhibitBookmark", Id = _newExhibit.Id, Type = "exhibit" };
            Bookmark timelineBookmark = new Bookmark { Name = "WebDriverApiTimelineBookmark", Id = _newTimeline.Id, Type = "timeline" };
            Collection<Chronozoom.Entities.Bookmark> bookmarks = new Collection<Chronozoom.Entities.Bookmark> { exhibitBookmark, timelineBookmark };
            _newTour.Bookmarks = bookmarks;

            #endregion

            HomePageHelper.OpenSandboxPage();
        }
        public void TestInitialize()
        {
            BrowserStateManager.RefreshState();
            #region create exhibit

            var contentItems = new Collection<ContentItem>();
            var contentItem = new ContentItem { Title = "WebDriverApi", MediaType = "image", Uri = @"http://yandex.st/www/1.609/yaru/i/logo.png", Caption = "", Order = 0, Attribution = "AttributionApI", MediaSource = "https://trello.com/board/development/510a91105420848638003cda" };
            contentItems.Add(contentItem);

            _newExhibit = new Exhibit
                {
                Timeline_ID = new Guid("bdc1ceff-76f8-4df4-ba72-96b353991314"),
                Title = "WebDriverApiExhibitAlexey",
                Year = -8596430000,
                ContentItems = contentItems
            };
            ApiHelper.CreateExhibitByApi(_newExhibit);

            #endregion
            HomePageHelper.OpenSandboxPage();
        }
        public void WhenSubscriberThrowsException()
        {
            // Arrange
              var bus = new MessageBus();
              bus.SubscriberFor<Message>(
            m =>
            {
              throw new Exception();
            });
              var exceptions = new Collection<AggregateException>();
              bus.ExceptionListener = exceptions.Add;

              // Act
              bus.SendMessage(new TestMessageTypeA());

              // Assert
              while (exceptions.Count == 0)
              {
            Thread.Sleep(100);
              }
        }
 public void TestTypeInFilter()
 {
     const string host = @"http://localhost:8080";
     const string user = "******";
     const string pw = "secret";
     var filters = new Collection<string> { new MingleFilter("Type", "Is", "Main Business Requirement").FilterFormatString };
     filters.Add( new MingleFilter("Type", "Is", "Business Use Case").FilterFormatString );
     filters.Add( new MingleFilter("Type", "Is", "Planning Card").FilterFormatString );
     var project = new MingleServer(host, user, pw).GetProject("bss_portfolio_sandbox");
     Assert.AreEqual(314, project.GetCards(filters).Count);
 }
        public void PrepBalanced()
        {
            Dictionary<String, Bus> buses = new Dictionary<string, Bus>();
            buses["b1"] = new Bus("b1", pr(132.79, 0), 132.79, new Point(0, 0));
            buses["b2"] = new Bus("b2", pr(133.73, -0.1), 132.79, new Point(0, 0));
            buses["b3"] = new Bus("b3", pr(133.55, -0.1), 132.79, new Point(0, 0));
            buses["b4"] = new Bus("b4", pr(133.99, -0.1), 132.79, new Point(0, 0));

            var lb1b2 = new Line("b1b2", 1);
            lb1b2.Connect(buses["b1"], buses["b2"]);
            var lb1b3 = new Line("b1b3", 2);
            lb1b3.Connect(buses["b1"], buses["b3"]);
            var lb2b4 = new Line("b2b4", 3);
            lb2b4.Connect(buses["b2"], buses["b4"]);
            var lb3b4 = new Line("b3b4", 4);
            lb3b4.Connect(buses["b3"], buses["b4"]);

            Collection<Line> lines = new Collection<Line>();
            lines.Add(lb1b2);
            lines.Add(lb1b3);
            lines.Add(lb2b4);
            lines.Add(lb3b4);

            Generator g = new Generator("g4", new Complex(318000, 0));

            g.Connect(buses["b4"]);
            Collection<Generator> generators = new Collection<Generator>();
            generators.Add(g);

            Collection<Load> loads = new Collection<Load>();
            var l1 = new Load("l1", new Complex(50000, 30990));
            l1.Connect(buses["b1"]);
            var l2 = new Load("l2", new Complex(170000, 105350));
            l2.Connect(buses["b2"]);
            var l3 = new Load("l3", new Complex(200000, 12940));
            l3.Connect(buses["b3"]);
            var l4 = new Load("l4", new Complex(80000, 49580));
            l4.Connect(buses["b4"]);
            loads.Add(l1);
            loads.Add(l2);
            loads.Add(l3);
            loads.Add(l4);

            model = new NetworkModel(buses, lines, loads, generators, new Complex(19580, -17810600), buses["b1"]);
        }
        public void PrepUnbalanced()
        {
            Dictionary<String, Bus> buses = new Dictionary<string, Bus>();
            buses["b1"] = new Bus("b1", pc3pr(130770, 0.4, 132860, -120.8, 134130, 120.6), 132.79, new Point(0, 0));
            buses["b2"] = new Bus("b2", pc3pr(866380, 99.9, 83445, -21.2, 86499, -142.5), 132.79, new Point(0, 0));
            buses["b3"] = new Bus("b3", pc3pr(94825, 14.5, 96205, -107.4, 98249, 134.2), 132.79, new Point(0, 0));
            buses["b4"] = new Bus("b4", pc3pr(67374, 68.6, 65606, -54, 69131, -174), 132.79, new Point(0, 0));

            var lb1b2 = new Line("b1b2", 1);
            lb1b2.Connect(buses["b1"], new[] { 1, 2, 3 }, buses["b2"], new[] { 2, 3, 1 });
            var lb1b3 = new Line("b1b3", 2);
            lb1b3.Connect3Phase(buses["b1"], buses["b3"]);
            var lb2b4 = new Line("b2b4", 3);
            lb2b4.Connect3Phase(buses["b2"], buses["b4"]);
            var lb3b4 = new Line("b3b4", 4);
            lb3b4.Connect(buses["b3"], buses["b4"], new[] { 1, 2 });

            Collection<Line> lines = new Collection<Line>();
            lines.Add(lb1b2);
            lines.Add(lb1b3);
            lines.Add(lb2b4);
            lines.Add(lb3b4);

            Generator g = new Generator("g4", pc3(106000, 0.9797, 106000, -1.3930, 106000, 0.4265));

            g.ConnectWye(buses["b4"]);
            Collection<Generator> generators = new Collection<Generator>();
            generators.Add(g);

            Collection<Load> loads = new Collection<Load>();
            var l1 = new Load("l1", pc3(16382, 10280, 16852, 10108, 16766, 10601));
            l1.ConnectWye(buses["b1"], 1, 2, 3);
            var l2 = new Load("l2", pcV(2, 85000, 52674, 3, 85000, 52675));
            l2.ConnectWye(buses["b2"], 2, 3);
            var l3 = new Load("l3", pcV(1, 200000, 12940));
            l3.ConnectWye(buses["b3"], 1, 2);
            var l4 = new Load("l4", pc3(26666, 16527, 26666, 16527, 26666, 16527));
            l4.ConnectWye(buses["b4"], 1, 2, 3);
            loads.Add(l1);
            loads.Add(l2);
            loads.Add(l3);
            loads.Add(l4);

            model = new NetworkModel(buses, lines, loads, generators, new Complex(140424, 692575), buses["b1"]);
        }
        public void TestAddCourseToStudent()
        {
            var address = new Address
            {
                City = "Fagaras",
                State = "Brasov",
                Country = "Romania",
                Street = "Campului",
                PostalCode = "50520"
            };

            var semester = new Semester
            {
                Name = "Winter",
                StartDate = DateTime.Today,
                EndDate = DateTime.Today.AddMonths(3)
            };

               var res = Validation.Validate(semester);
            Assert.AreEqual(res.IsValid, false, res.IsValid ? "" : "Validation Failed: " + res.First().Message);

            var c1 = new Course
            {
                Name = "C#",
                Description = "Introduction to .NET Framework with C#",
                Cost = 222,
                Currency = "RON",
                Credits = 10,
                LowerBound = 10,
                UpperBound = 1000,
               // Semesters = new[] {semester}
            };

            res = Validation.Validate(c1);
            Assert.AreEqual(res.IsValid, true, res.IsValid ? "" : "Validation Failed: " + res.First().Message);

            var courses = new Collection<Course> { c1 };

            var emails = new Collection<Email>(new[] { new Email { EmailAddress = "*****@*****.**" }  });

            var student = new Student
            {
                FirstName = "qweewr",
                LastName = "sdfsfds",
                CNP = "1234567890123",
                SID = 1,
                EnrollmentDate = DateTime.Now,
                Emails = emails,
                Courses = courses,
                Address = address
            };

            address.Student = student;
            res = Validation.Validate(address);
            Assert.AreEqual(res.IsValid, true, res.IsValid ? "" : "Validation Failed: " + res.First().Message);

            res = Validation.Validate(student);
            Assert.AreEqual(res.IsValid, true, res.IsValid ? "" : "Validation Failed: " + res.First().Message);

            _studentService.AddStudent(student);
            var studentId = student.StudentId;
            var lastInsertStudent = _studentService.GetStudentById(studentId);

            Assert.AreEqual(student.StudentId, lastInsertStudent.StudentId);
            Assert.AreEqual(student.FirstName, lastInsertStudent.FirstName);
            Assert.AreEqual(student.LastName, lastInsertStudent.LastName);
        }