Ejemplo n.º 1
0
        public async Task RefreshToken_Success_ReturnStatusCodeOk()
        {
            //login again
            IHttpActionResult result = await userController.Login(new LoginViewModel()
            {
                Email        = "superuser@su",
                Password     = "******",
                DeviceNumber = "PTX123"
            });

            HttpJsonApiResult <TokenViewModel> contentResult = result as HttpJsonApiResult <TokenViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);


            //refresh token
            IHttpActionResult result2 = await userController.RefreshToken(new WebTokenViewModel()
            {
                Token = contentResult.DataValue.RefreshToken
            });

            HttpJsonApiResult <TokenViewModel> contentResult2 = result2 as HttpJsonApiResult <TokenViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult2.StatusCode);
        }
Ejemplo n.º 2
0
        public async Task DeleteCustomerWithParameterId6NotFound_ShouldReturnHttpStatusCode404()
        {
            HttpJsonApiResult <string> data = await _customerController.Delete(6)
                                              as HttpJsonApiResult <string>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.NotFound);
        }
        public async Task ReadSignatureWithParamterId5NotFound_ShouldReturnHttpStatusCode404()
        {
            HttpJsonApiResult <string> data = await _signatureController.Get(5)
                                              as HttpJsonApiResult <string>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.NotFound);
        }
Ejemplo n.º 4
0
        public async Task ReadCreditApprovalWithParameterIdIs2_ShouldReturnHttpStatusCode200()
        {
            HttpJsonApiResult <CreditApprovalModel> data = await _creditApprovalController.Get(2)
                                                           as HttpJsonApiResult <CreditApprovalModel>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.OK);
        }
Ejemplo n.º 5
0
        public async Task ReadCreditApprovalWithParameterIdIs7_ShouldReturnHttpStatusCode404()
        {
            HttpJsonApiResult <string> data = await _creditApprovalController.Get(7)
                                              as HttpJsonApiResult <string>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.NotFound);
        }
        public async Task ReadTrCaNoteFailed_ShouldReturnHttpStatusCode404()
        {
            HttpJsonApiResult <string> data = await _trCaNoteController.Get(4)
                                              as HttpJsonApiResult <string>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.NotFound);
        }
        public async Task ReadTrCaNoteSuccess_ShouldReturnHttpStatusCode200()
        {
            HttpJsonApiResult <TrCaNoteModel> data = await _trCaNoteController.Get(1)
                                                     as HttpJsonApiResult <TrCaNoteModel>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.OK);
        }
        public async Task SoftDeleteSupplier_NotFound_ReturnStatusCodeNotFound()
        {
            IHttpActionResult result = await supplierController.Delete(Guid.NewGuid());

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.NotFound, contentResult.StatusCode);
        }
Ejemplo n.º 9
0
        public async Task EditSale_NotFound_ReturnStatusCodeNotFound()
        {
            IHttpActionResult result = await saleController.Edit(Guid.NewGuid(), new Sale());

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.NotFound, contentResult.StatusCode);
        }
Ejemplo n.º 10
0
        public async Task EditSale_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await saleController.Edit(new Guid("3bc4d343-1a0d-432f-a190-d8f76ebb1ab9"), new Sale());

            HttpJsonApiResult <SaleViewModel> contentResult = result as HttpJsonApiResult <SaleViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
Ejemplo n.º 11
0
        public async Task HardDeleteUser_UserNotFound_ReturnStatusCodeNotFound()
        {
            IHttpActionResult result = await userController.HardDeleteUser(new Guid("ba740d49-49f8-4fce-a973-df7dc1a1cbc7"));

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.NotFound, contentResult.StatusCode);
        }
Ejemplo n.º 12
0
        public async Task HardDeleteUser_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await userController.HardDeleteUser(new Guid("fbc41aa2-b12e-4494-99ba-711278de74c7"));

            HttpJsonApiResult <UserViewModel> contentResult = result as HttpJsonApiResult <UserViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
Ejemplo n.º 13
0
        public async Task LogoutAll_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await userController.LogoutAll();

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
Ejemplo n.º 14
0
        public async Task SoftDeleteRole_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await roleController.Delete(new Guid("5579b911-2392-43f8-87cf-83e1a7bbed6f"));

            HttpJsonApiResult <RoleViewModel> contentResult = result as HttpJsonApiResult <RoleViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
        public async Task ReadSupplier_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await supplierController.Get(new Guid("bbbf396b-5b78-4924-bd21-a9afa9decfc8"));

            HttpJsonApiResult <SupplierViewModel> contentResult = result as HttpJsonApiResult <SupplierViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
        public async Task ReadProduct_NotFound_ReturnStatusCodeNotFound()
        {
            IHttpActionResult result = await productController.Get(Guid.NewGuid());

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.NotFound, contentResult.StatusCode);
        }
        public async Task ReadPurchase_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await purchaseController.Get(new Guid("3bc4d343-1a0d-432f-a190-d8f76ebb1ab9"));

            HttpJsonApiResult <PurchaseDetailViewModel> contentResult = result as HttpJsonApiResult <PurchaseDetailViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
        public async Task HardDeleteProduct_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await productController.HardDeleteProduct(new Guid("5579b911-2392-43f8-87cf-83e1a7bbed6f"));

            HttpJsonApiResult <ProductViewModel> contentResult = result as HttpJsonApiResult <ProductViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
        public async Task ReadProduct_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await productController.Get(new Guid("223913df-203a-41e2-83a9-94343ee5d434"));

            HttpJsonApiResult <ProductViewModel> contentResult = result as HttpJsonApiResult <ProductViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
Ejemplo n.º 20
0
        public async Task ReadReceivedProduct_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await receivedProductController.Get(new Guid("3bc4d343-1a0d-432f-a190-d8f76ebb1ab9"));

            HttpJsonApiResult <IEnumerable <ReceivedProductViewModel> > contentResult = result as HttpJsonApiResult <IEnumerable <ReceivedProductViewModel> >;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
Ejemplo n.º 21
0
        public async Task ReadListCreditApprovalSuccess_ShouldReturnHttpStatusCode200AndCountValue6()
        {
            HttpJsonApiResult <IEnumerable <CreditApprovalModel> > data = await _creditApprovalController.Get()
                                                                          as HttpJsonApiResult <IEnumerable <CreditApprovalModel> >;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.OK);
            Assert.AreEqual(new List <CreditApprovalModel>(data.DataValue).Count, 6);
        }
        public async Task ReadListSignature_ShouldReturnHttpStatusCode200AndCountValue4()
        {
            HttpJsonApiResult <IEnumerable <SignatureModel> > data = await _signatureController.Get()
                                                                     as HttpJsonApiResult <IEnumerable <SignatureModel> >;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.OK);
            Assert.AreEqual(new List <SignatureModel>(data.DataValue).Count, 4);
        }
Ejemplo n.º 23
0
        public async Task DeleteReceivedProduct_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await receivedProductController.Delete(new Guid("839b0da7-50f7-4af0-98bf-4bd746cfa192"));

            HttpJsonApiResult <ReceivedProductViewModel> contentResult = result as HttpJsonApiResult <ReceivedProductViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
        public async Task ReadCategory_Success_ReturnStatusCodeOk()
        {
            IHttpActionResult result = await categoryController.Get(new Guid("fbc41aa2-b12e-4494-99ba-711278de74c7"));

            HttpJsonApiResult <CategoryViewModel> contentResult = result as HttpJsonApiResult <CategoryViewModel>;

            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
        }
        public async Task HardDeleteCategory_NotFound_ReturnStatusCodeNotFound()
        {
            IHttpActionResult result = await categoryController.HardDeleteProduct(Guid.NewGuid());

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.NotFound, contentResult.StatusCode);
        }
        public async Task UpdatedTrCaNoteSuccess_ShouldReturnHttpStatusCode200()
        {
            HttpJsonApiResult <TrCaNoteModel> data = await _trCaNoteController.Update(1, new TrCaNoteRequest()
            {
                Perihal = "testing",
                Isi     = "Hahahahahaha"
            }) as HttpJsonApiResult <TrCaNoteModel>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.OK);
        }
        public async Task UpdatedTrCaNoteFailed_ShouldReturnHttpStatusCode404()
        {
            HttpJsonApiResult <string> data = await _trCaNoteController.Update(7, new TrCaNoteRequest()
            {
                Perihal = "testing",
                Isi     = "Hahahahahaha"
            }) as HttpJsonApiResult <string>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.NotFound);
        }
Ejemplo n.º 28
0
        public async Task UserLoginNotFound_ShouldReturnHttpStatusCode404()
        {
            HttpJsonApiResult <string> data = await _userController.Login(new LoginData()
            {
                Email    = "*****@*****.**",
                Password = "******"
            }) as HttpJsonApiResult <string>;

            Assert.AreEqual(data.StatusCode, HttpStatusCode.NotFound);
        }
        public async Task CreateCategory_Success_ReturnStatusCodeCreated()
        {
            IHttpActionResult result = await categoryController.Create(new Category()
            {
                Name = "Potion"
            });

            HttpJsonApiResult <CategoryViewModel> contentResult = result as HttpJsonApiResult <CategoryViewModel>;

            Assert.AreEqual(HttpStatusCode.Created, contentResult.StatusCode);
        }
        public async Task EditCategory_NotFound_ReturnStatusCodeNotFound()
        {
            IHttpActionResult result = await categoryController.Edit(Guid.NewGuid(), new Category()
            {
                Name = "Gun"
            });

            HttpJsonApiResult <string> contentResult = result as HttpJsonApiResult <string>;

            Assert.AreEqual(HttpStatusCode.NotFound, contentResult.StatusCode);
        }