Exemplo n.º 1
0
        public void GetAll_DatabaseEmpty_True()
        {
            //Arrange, Act
            int result = Rock.GetAll().Count;

            //Assert
            Assert.Equal(0, result);
        }
Exemplo n.º 2
0
        public void Test_DeleteAll_ClearsDatabase()
        {
            Rock newRock = new Rock("sapphire", 1);

            newRock.Save();

            Rock.DeleteAll();
            int result = Rock.GetAll().Count;

            Assert.Equal(0, result);
        }
Exemplo n.º 3
0
        public void Save_SaveObjectToDB_True()
        {
            Rock        newRock        = new Rock("quartz", 3);
            List <Rock> expectedResult = new List <Rock> {
                newRock
            };

            newRock.Save();
            List <Rock> result = Rock.GetAll();

            Assert.Equal(expectedResult, result);
        }
Exemplo n.º 4
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };
            Post["/"] = _ => {
                Rock newRock = new Rock(Request.Form["name"], Request.Form["mass"]);
                newRock.Save();
                List <Rock> allRocks = Rock.GetAll();

                return(View["index.cshtml", allRocks]);
            };
        }