public void Index_View_Data_Count_Test()
        {
            DonorController controller = new DonorController();
            ViewResult      view       = controller.Index();

            Assert.AreEqual(((List <BLL.Donor>)view.ViewData.Model).Count, new BLL.CTSContext().Donors.Count());
        }
        public void Index_View_Data_Test()
        {
            DonorController controller = new DonorController();
            ViewResult      view       = controller.Index();

            Assert.IsInstanceOfType(view.ViewData.Model, typeof(List <BLL.Donor>));
        }
        public void Index_View_Test()
        {
            DonorController controller = new DonorController();
            ViewResult      view       = controller.Index();

            Assert.AreEqual("", view.ViewName);
        }
        public void EnrollAgainInSystem()
        {
            //Arrange
            DonorController donorController = new DonorController();

            //Act
            donorController.Enroll(donor);

            //Assert
            Assert.AreEqual("Available", donor.Status);
        }
        public void UnrollFromSystem()
        {
            //Arrange
            DonorController donorController = new DonorController();

            //Act
            testDonor = homeController.LoginAsDonor(testDonor.Email, testDonor.Password);
            donorController.Unroll(testDonor);

            //Assert
            Assert.IsTrue(homeController.LoginAsDonor(testDonor.Email, testDonor.Password) == null);
        }
Exemple #6
0
        public void Init()
        {
            var donors = new List <Donor>
            {
                new Donor {
                    DonorID = 1, Name = "UN - World Food Program", DonorCode = "WFP", IsResponsibleDonor = true, IsSourceDonor = true, LongName = "UN - World Food Program"
                },
                new Donor {
                    DonorID = 2, Name = "UK", DonorCode = "UK", IsResponsibleDonor = true, IsSourceDonor = true, LongName = "United Kingdom"
                },
            };
            var donorService = new Mock <IDonorService>();

            donorService.Setup(t => t.GetAllDonor()).Returns(donors);
            _donorController = new DonorController(donorService.Object);
        }
Exemple #7
0
        public void init()
        {
            var donor = new List <Donor>
            {
                new Donor {
                    DonorID = 1, DonorCode = "WFP", Name = "World Food Program", IsResponsibleDonor = true, IsSourceDonor = false, LongName = "World Food Program"
                },
                new Donor {
                    DonorID = 2, DonorCode = "UN", Name = "United Nations", IsResponsibleDonor = false, IsSourceDonor = true, LongName = "United Nations"
                }
            };
            var donorService = new Mock <IDonorService>();

            donorService.Setup(m => m.GetAllDonor()).Returns(donor);

            _donorController = new DonorController(donorService.Object);
        }
Exemple #8
0
        public void SetUp()
        {
            _donorService          = new Mock <IDonorService>();
            _donationService       = new Mock <IDonationService>();
            _paymentService        = new Mock <IPaymentProcessorService>();
            _authenticationService = new Mock <IAuthenticationRepository>();
            _mpDonorService        = new Mock <MPInterfaces.IDonorRepository>();
            _impersonationService  = new Mock <IUserImpersonationService>();
            _fixture = new DonorController(_donorService.Object, _paymentService.Object, _donationService.Object, _mpDonorService.Object, _authenticationService.Object, _impersonationService.Object);

            _authType        = "auth_type";
            _authToken       = "auth_token";
            _fixture.Request = new HttpRequestMessage();
            _fixture.Request.Headers.Authorization = new AuthenticationHeaderValue(_authType, _authToken);
            _fixture.RequestContext = new HttpRequestContext();

            // This is needed in order for Request.createResponse to work
            _fixture.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            _fixture.Request.SetConfiguration(new HttpConfiguration());
        }
Exemple #9
0
        public void RegisterAsDonorTest()
        {
            //Arrange
            DonorController donorController = new DonorController();

            HomeController homeController = new HomeController();
            string         name           = "Ralitsa Mladenova";
            string         email          = "*****@*****.**";
            string         password       = "******";
            string         phoneNumber    = "0888654321";
            string         status         = "Available";
            string         bloodGroup     = "0+";

            //Act
            bool  expected = homeController.RegisterAsDonor(email, password, name, phoneNumber, status, bloodGroup);
            Donor donor    = homeController.LoginAsDonor(email, password);

            //Assert
            Assert.IsTrue(expected && donor != null);

            //Clean-Up
            donorController.Unroll(donor);
        }
Exemple #10
0
 public DonorControllerTest()
 {
     _dummyContext          = new DummyDbContext();
     _appVariableRepository = new Mock <IAppVariableRepository>();
     _controller            = new DonorController(_appVariableRepository.Object, null);
 }
Exemple #11
0
 /// <summary>Initializes a new instance of the <see cref="T:DonorSystem.Views.DonorMenu" /> class and displays the menu for the donor role.</summary>
 /// <param name="donor">The donor.</param>
 public DonorMenu(Donor donor)
 {
     donorController = new DonorController();
     ShowDonorMenu(donor);
 }