コード例 #1
0
        public void Test_Constructor_ConstructorCreatesObject()
        {
            // Arrange
            string   firstExpected      = "Doc";
            string   lastExpected       = "Gonzo";
            string   ssnExpected        = "000-00-0000";
            string   typeExpected       = "Medical";
            string   salaryTypeExpected = "Annual";
            string   emailExpected      = "*****@*****.**";
            string   passwordExpected   = "password";
            DateTime hireDateExpected   = new DateTime(2016, 1, 1);
            // Act
            Physician newPhysician = new Physician(firstExpected, lastExpected, ssnExpected, typeExpected, salaryTypeExpected, emailExpected, passwordExpected, hireDateExpected);

            newPhysician.Save("physicians");
            // Assert
            Assert.Equal(firstExpected, newPhysician.GetFirstName());
        }
コード例 #2
0
        public void Test_Save_AssignsIdToObject()
        {
            //Arrange
            string    firstExpected      = "Doc";
            string    lastExpected       = "Gonzo";
            string    ssnExpected        = "000-00-0000";
            string    typeExpected       = "Medical";
            string    salaryTypeExpected = "Annual";
            string    emailExpected      = "*****@*****.**";
            string    passwordExpected   = "password";
            DateTime  hireDateExpected   = new DateTime(2016, 1, 1);
            Physician newPhysician       = new Physician(firstExpected, lastExpected, ssnExpected, typeExpected, salaryTypeExpected, emailExpected, passwordExpected, hireDateExpected);

            newPhysician.Save("physicians");
            int expectedId = newPhysician.GetId();
            //Act
            Employee savedPhysician = Employee.GetAll("physicians")[0]; // think this is incorrect, just a workaround
            int      actualId       = savedPhysician.GetId();

            //Assert
            Assert.Equal(expectedId, actualId);
        }