public void SaveUser()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          user        = new UserModel
            {
                UserName    = "******",
                EntityState = LogicBuilder.Domain.EntityStateType.Added
            };

            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = user
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("saveuser");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid user  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Empty(flowManager.FlowDataCache.Response.ErrorMessages);

            UserModel model = (UserModel)((SaveEntityResponse)flowManager.FlowDataCache.Response).Entity;

            Assert.True(model.UserId > 1);
            Assert.Equal("NewName", model.UserName);
        }
Пример #2
0
        public void SaveInvalidCertification()
        {
            //arrange
            IFlowManager flowManager   = serviceProvider.GetRequiredService <IFlowManager>();
            var          certification = flowManager.EnrollmentRepository.GetAsync <CertificationModel, Certification>
                                         (
                s => s.UserId == 1
                                         ).Result.Single();

            certification.CertificateStatementChecked = false;
            certification.DeclarationStatementChecked = false;
            certification.PolicyStatementsChecked     = false;
            certification.EntityState         = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = certification
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savecertification");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid certification = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(3, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
        public void SaveMoreInfo()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          moreInfo    = flowManager.EnrollmentRepository.GetAsync <MoreInfoModel, MoreInfo>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            moreInfo.MilitaryStatus           = "AR";
            moreInfo.EntityState              = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = moreInfo
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savemoreInfo");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid moreInfo  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Empty(flowManager.FlowDataCache.Response.ErrorMessages);

            MoreInfoModel model = (MoreInfoModel)((SaveEntityResponse)flowManager.FlowDataCache.Response).Entity;

            Assert.Equal("AR", model.MilitaryStatus);
        }
        public void SaveInvalidMoreInfo()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          moreInfo    = flowManager.EnrollmentRepository.GetAsync <MoreInfoModel, MoreInfo>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            moreInfo.IsVeteran              = true;
            moreInfo.ReasonForAttending     = null;
            moreInfo.OverallEducationalGoal = null;
            moreInfo.MilitaryStatus         = null;
            moreInfo.MilitaryBranch         = null;
            moreInfo.VeteranType            = null;

            moreInfo.EntityState = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = moreInfo
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savemoreInfo");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid moreInfo = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(5, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
        public void SaveInvalidContactInfo()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          user        = new UserModel
            {
                UserName    = "******",
                EntityState = LogicBuilder.Domain.EntityStateType.Added
            };

            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = user
            };
            flowManager.Start("saveuser");
            Assert.True(user.UserId > 1);

            var contactInfo = new ContactInfoModel
            {
                UserId               = user.UserId,
                EntityState          = LogicBuilder.Domain.EntityStateType.Added,
                HasFormerName        = true,
                FormerFirstName      = null,
                FormerMiddleName     = null,
                FormerLastName       = null,
                DateOfBirth          = default,
Пример #6
0
        public void SaveInvalidCourse()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();

            flowManager.FlowDataCache.Request = new SaveEntityRequest
            {
                Entity = new CourseModel
                {
                    EntityState  = LogicBuilder.Domain.EntityStateType.Modified,
                    CourseID     = 0,
                    Credits      = 6,
                    DepartmentID = 0,
                    Title        = ""
                }
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savecourse");
            stopWatch.Stop();
            this.output.WriteLine("Saving invalid course  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(4, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
Пример #7
0
        public void SaveInvalidCourse1()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          course      = flowManager.SchoolRepository.GetAsync <CourseModel, Course>
                                       (
                s => s.CourseID == 1050
                                       ).Result.Single();

            course.CourseID     = 0;
            course.Credits      = 6;
            course.DepartmentID = 0;
            course.Title        = "";
            course.EntityState  = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveCourseRequest {
                Course = course
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savecourse");
            stopWatch.Stop();
            this.output.WriteLine("Saving invalid course  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
        }
Пример #8
0
        public void SaveInvalidStudentRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          student     = flowManager.SchoolRepository.GetAsync <StudentModel, Student>
                                       (
                s => s.FullName == "Carson Alexander"
                                       ).Result.Single();

            student.FirstName                 = "";
            student.LastName                  = "";
            student.EnrollmentDate            = default;
            student.EntityState               = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveStudentRequest {
                Student = student
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savestudent");
            stopWatch.Stop();
            this.output.WriteLine("Saving invalid student = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(3, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
        public void DeleteDepartmentNotFoundRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          department  = flowManager.SchoolRepository.GetAsync <DepartmentModel, Department>
                                       (
                s => s.Name == "Mathematics"
                                       ).Result.Single();

            department.DepartmentID           = Int32.MaxValue;
            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = department
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deletedepartment");
            stopWatch.Stop();
            this.output.WriteLine("Deleting department not found = {0}", stopWatch.Elapsed.TotalMilliseconds);

            department = flowManager.SchoolRepository.GetAsync <DepartmentModel, Department>
                         (
                s => s.Name == "Mathematics"
                         ).Result.SingleOrDefault();

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(1, flowManager.FlowDataCache.Response.ErrorMessages.Count);
            Assert.NotNull(department);
        }
Пример #10
0
        public void SaveInvalidAdmissions()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          admissions  = flowManager.EnrollmentRepository.GetAsync <AdmissionsModel, Admissions>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            admissions.EnteringStatus         = null;
            admissions.EnrollmentTerm         = null;
            admissions.EnrollmentYear         = null;
            admissions.ProgramType            = null;
            admissions.Program                = null;
            admissions.EntityState            = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = admissions
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("saveadmissions");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid admissions = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(5, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
Пример #11
0
        public void DeleteInvalidCourseRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          course      = flowManager.SchoolRepository.GetAsync <CourseModel, Course>
                                       (
                s => s.Title == "Composition"
                                       ).Result.Single();

            course.Title = "";
            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = course
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deletecourse");
            stopWatch.Stop();
            this.output.WriteLine("Deleting invalid course = {0}", stopWatch.Elapsed.TotalMilliseconds);

            course = flowManager.SchoolRepository.GetAsync <CourseModel, Course>
                     (
                s => s.Title == "Composition"
                     ).Result.SingleOrDefault();

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(1, flowManager.FlowDataCache.Response.ErrorMessages.Count);
            Assert.NotNull(course);
        }
        public void DeleteInvalidStudentRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          student     = flowManager.SchoolRepository.GetAsync <StudentModel, Student>
                                       (
                s => s.FullName == "Carson Alexander"
                                       ).Result.Single();

            student.FirstName = "";
            student.LastName  = "";
            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = student
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deletestudent");
            stopWatch.Stop();
            this.output.WriteLine("Deleting invalid student = {0}", stopWatch.Elapsed.TotalMilliseconds);

            student = flowManager.SchoolRepository.GetAsync <StudentModel, Student>
                      (
                s => s.FullName == "Carson Alexander"
                      ).Result.SingleOrDefault();

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(2, flowManager.FlowDataCache.Response.ErrorMessages.Count);
            Assert.NotNull(student);
        }
Пример #13
0
        public void DeleteContactInfoNotFoundRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          contactInfo = flowManager.EnrollmentRepository.GetAsync <ContactInfoModel, ContactInfo>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            contactInfo.UserId = Int32.MaxValue;
            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = contactInfo
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deletecontactInfo");
            stopWatch.Stop();
            this.output.WriteLine("Deleting contactInfo not found = {0}", stopWatch.Elapsed.TotalMilliseconds);

            contactInfo = flowManager.EnrollmentRepository.GetAsync <ContactInfoModel, ContactInfo>
                          (
                s => s.UserId == 1
                          ).Result.SingleOrDefault();

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(1, flowManager.FlowDataCache.Response.ErrorMessages.Count);
            Assert.NotNull(contactInfo);
        }
Пример #14
0
        public void SaveInvalidInstructorRequest1()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          instructor  = flowManager.SchoolRepository.GetAsync <InstructorModel, Instructor>
                                       (
                s => s.FullName == "Roger Zheng"
                                       ).Result.Single();

            instructor.ID                     = 0;
            instructor.FirstName              = "";
            instructor.LastName               = "";
            instructor.HireDate               = default;
            instructor.EntityState            = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = instructor
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("saveInstructor");
            stopWatch.Stop();
            this.output.WriteLine("Saving invalid Instructor = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(3, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
Пример #15
0
        public void DeleteValidContactInfoRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          contactInfo = flowManager.EnrollmentRepository.GetAsync <ContactInfoModel, ContactInfo>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = contactInfo
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deletecontactInfo");
            stopWatch.Stop();
            this.output.WriteLine("Deleting valid contactInfo = {0}", stopWatch.Elapsed.TotalMilliseconds);

            contactInfo = flowManager.EnrollmentRepository.GetAsync <ContactInfoModel, ContactInfo>
                          (
                s => s.UserId == 1
                          ).Result.SingleOrDefault();

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Null(contactInfo);
        }
Пример #16
0
        public void SaveStudent()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();

            flowManager.FlowDataCache.Request = new SaveEntityRequest
            {
                Entity = new StudentModel
                {
                    EntityState    = LogicBuilder.Domain.EntityStateType.Modified,
                    FirstName      = "John",
                    LastName       = "Hopkins",
                    EnrollmentDate = new DateTime(2018, 3, 3)
                }
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savestudent");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid student  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
        }
Пример #17
0
        public void SaveInvalidStudent()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();

            flowManager.FlowDataCache.Request = new SaveEntityRequest
            {
                Entity = new StudentModel
                {
                    EntityState    = LogicBuilder.Domain.EntityStateType.Modified,
                    FirstName      = "",
                    LastName       = "",
                    EnrollmentDate = default
                }
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savestudent");
            stopWatch.Stop();
            this.output.WriteLine("Saving invalid student  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(3, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
        public void SavePersonal()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          personal    = flowManager.EnrollmentRepository.GetAsync <PersonalModel, Personal>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            personal.FirstName   = "Samson";
            personal.EntityState = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = personal
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savepersonal");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid personal  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Empty(flowManager.FlowDataCache.Response.ErrorMessages);

            PersonalModel model = (PersonalModel)((SaveEntityResponse)flowManager.FlowDataCache.Response).Entity;

            Assert.Equal("Samson", model.FirstName);
        }
Пример #19
0
        public void SaveInvalidDepartment()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();

            flowManager.FlowDataCache.Request = new SaveEntityRequest
            {
                Entity = new DepartmentModel
                {
                    EntityState  = LogicBuilder.Domain.EntityStateType.Modified,
                    InstructorID = null,
                    Budget       = -1,
                    StartDate    = new DateTime(),
                    Name         = ""
                }
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savedepartment");
            stopWatch.Stop();
            this.output.WriteLine("Saving invalid department  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(4, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
Пример #20
0
        public void SaveValidStudentRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          student     = flowManager.SchoolRepository.GetAsync <StudentModel, Student>
                                       (
                s => s.FullName == "Carson Alexander"
                                       ).Result.Single();

            student.FirstName   = "First";
            student.EntityState = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = student
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savestudent");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid student = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Equal("First", ((StudentModel)((SaveEntityResponse)flowManager.FlowDataCache.Response).Entity).FirstName);
        }
Пример #21
0
        public void SaveValidInstructorRequest2()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          instructor  = flowManager.SchoolRepository.GetAsync <InstructorModel, Instructor>
                                       (
                s => s.FullName == "Roger Zheng"
                                       ).Result.Single();

            instructor.FirstName              = "First";
            instructor.EntityState            = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveInstructorRequest {
                Instructor = instructor
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("saveinstructor");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid Instructor = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Equal("First", ((SaveInstructorResponse)flowManager.FlowDataCache.Response).Instructor.FirstName);
        }
Пример #22
0
        public void DeleteInstructorNotFoundRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          instructor  = flowManager.SchoolRepository.GetAsync <InstructorModel, Instructor>
                                       (
                s => s.FullName == "Candace Kapoor"
                                       ).Result.Single();

            instructor.ID = Int32.MaxValue;
            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = instructor
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deleteinstructor");
            stopWatch.Stop();
            this.output.WriteLine("Deleting instructor not found = {0}", stopWatch.Elapsed.TotalMilliseconds);

            instructor = flowManager.SchoolRepository.GetAsync <InstructorModel, Instructor>
                         (
                s => s.FullName == "Candace Kapoor"
                         ).Result.SingleOrDefault();

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(1, flowManager.FlowDataCache.Response.ErrorMessages.Count);
            Assert.NotNull(instructor);
        }
Пример #23
0
        public void DeleteValidInstructorRequest()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          instructor  = flowManager.SchoolRepository.GetAsync <InstructorModel, Instructor>
                                       (
                s => s.FullName == "Candace Kapoor"
                                       ).Result.Single();

            flowManager.FlowDataCache.Request = new DeleteEntityRequest {
                Entity = instructor
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("deleteinstructor");
            stopWatch.Stop();
            this.output.WriteLine("Deleting valid instructor = {0}", stopWatch.Elapsed.TotalMilliseconds);

            instructor = flowManager.SchoolRepository.GetAsync <InstructorModel, Instructor>
                         (
                s => s.FullName == "Candace Kapoor"
                         ).Result.SingleOrDefault();

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Null(instructor);
        }
        public void SaveDepartment2()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          department  = flowManager.SchoolRepository.GetItemsAsync <DepartmentModel, Department>
                                       (
                s => s.Name == "Mathematics"
                                       ).Result.Single();

            department.Budget                 = 1000.1m;
            department.EntityState            = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveDepartmentRequest {
                Department = department
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savedepartment");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid department  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(1000.1m, ((SaveDepartmentResponse)flowManager.FlowDataCache.Response).Department.Budget);
        }
Пример #25
0
        public void SaveCourse2()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          course      = flowManager.SchoolRepository.GetAsync <CourseModel, Course>
                                       (
                s => s.CourseID == 1050
                                       ).Result.Single();

            course.Title       = "First";
            course.EntityState = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = course
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savecourse");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid course  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Equal("First", ((CourseModel)((SaveEntityResponse)flowManager.FlowDataCache.Response).Entity).Title);
        }
        public void SaveInvalidPersonal()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          personal    = flowManager.EnrollmentRepository.GetAsync <PersonalModel, Personal>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            personal.FirstName                = null;
            personal.MiddleName               = null;
            personal.LastName                 = null;
            personal.PrimaryEmail             = "123";
            personal.Address1                 = null;
            personal.City                     = null;
            personal.State                    = "NC";
            personal.County                   = null;
            personal.ZipCode                  = "123";
            personal.CellPhone                = "123";
            personal.OtherPhone               = "123";
            personal.EntityState              = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = personal
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savepersonal");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid personal = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(10, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
Пример #27
0
        public void SaveInvalidUser()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          user        = flowManager.EnrollmentRepository.GetAsync <UserModel, User>
                                       (
                s => s.UserId == 1
                                       ).Result.Single();

            user.UserName    = null;
            user.EntityState = LogicBuilder.Domain.EntityStateType.Modified;
            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = user
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("saveuser");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid user = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.False(flowManager.FlowDataCache.Response.Success);
            Assert.Equal(1, flowManager.FlowDataCache.Response.ErrorMessages.Count);
        }
Пример #28
0
        public void SaveDepartment()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();

            flowManager.FlowDataCache.Request = new SaveEntityRequest
            {
                Entity = new DepartmentModel
                {
                    EntityState  = LogicBuilder.Domain.EntityStateType.Modified,
                    InstructorID = 1,
                    Budget       = 10000,
                    StartDate    = new DateTime(2020, 2, 2),
                    Name         = "Physics"
                }
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savedepartment");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid department  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
        }
 public BuilderMessageReceiver(
     IFlowManager flowManager,
     BuilderSettings settings,
     IContactExtension contactExtension,
     IDirectoryExtension directoryExtension,
     ISender sender,
     IStateManager stateManager,
     IDocumentSerializer documentSerializer,
     IEnvelopeSerializer envelopeSerializer,
     IArtificialIntelligenceExtension artificialIntelligenceExtension,
     IContextProvider contextProvider,
     IUserOwnerResolver userOwnerResolver,
     ILogger logger)
     : base(contactExtension, directoryExtension, logger)
 {
     _flowManager        = flowManager;
     _settings           = settings;
     _sender             = sender;
     _stateManager       = stateManager;
     _documentSerializer = documentSerializer;
     _envelopeSerializer = envelopeSerializer;
     _contextProvider    = contextProvider;
     _userOwnerResolver  = userOwnerResolver;
     _artificialIntelligenceExtension = artificialIntelligenceExtension;
 }
Пример #30
0
 public TransferController(ILogger <TransferController> logger, IRulesRepository rulesRepository, IRulesCache rulesCache, IRulesManager rulesManager, IFlowManager flowManager)
 {
     _logger            = logger;
     _rulesRepository   = rulesRepository;
     this._rulesCache   = rulesCache;
     this._rulesManager = rulesManager;
     this._flowManager  = flowManager;
 }