Exemple #1
0
        public void RegisteringNewCompany()
        {
            RegistrationController controller = new RegistrationController();
            CompanyViewModel       testModel  = new CompanyViewModel();
            TestHelper             helper     = new TestHelper();

            testModel.CompanyName         = helper.RandomString(50, false);
            testModel.CompanyEmailAddress = helper.RandomString(250, false);
            testModel.CompanyPhoneNumber  = helper.RandomString(20, false);
            testModel.CompanyAddressLine1 = helper.RandomString(250, false);
            testModel.CompanyAddressLine2 = helper.RandomString(250, false);
            testModel.CompanyAddressLine3 = helper.RandomString(250, false);
            testModel.PostalCode          = helper.RandomNumber(1000, 9999).ToString();
            testModel.City = helper.RandomString(50, false);

            Array  values   = Enum.GetValues(typeof(State));
            Random random   = new Random();
            State  rdmState = (State)values.GetValue(helper.RandomNumber(0, 12));

            //Passing empty model
            int returnedResult = controller.CreateNewCompany(null);

            Assert.AreEqual(0, returnedResult);

            //Register company successfully
            int secondReturnedResult = controller.CreateNewCompany(testModel);

            Assert.AreEqual(1, secondReturnedResult);

            //Same company registering
            //testModel.CompanyEmailAddress = "*****@*****.**";
            //int thirdReturnedResult = controller.CreateNewCompany(testModel);
            //Assert.AreEqual(2, thirdReturnedResult);
        }