Exemplo n.º 1
0
        public async Task AddBike_PositiveTest()
        {
            BikeModel            bikeModel  = new BikeModel();
            Mock <IModelManager> mockObject = new Mock <IModelManager>();

            mockObject.Setup(x => x.AddBike(bikeModel));
            var api = new AdminController(mockObject.Object);
            var res = (RedirectToRouteResult)await api.AddBike(bikeModel);

            Assert.AreEqual(res.RouteValues["action"], "AddBike");
        }
Exemplo n.º 2
0
        public async Task AddBike_NullTest()
        {
            BikeModel bikeModel = new BikeModel()
            {
                BikeName = "Hero"
            };
            Mock <IModelManager> mockObject = new Mock <IModelManager>();

            bikeModel = null;

            mockObject.Setup(x => x.AddBike(bikeModel));
            var api = new AdminController(mockObject.Object);
            var res = api.AddBike(bikeModel);

            var response = await res as ViewResult;

            Assert.AreEqual(response.ViewName, "null");
        }