コード例 #1
0
        public async Task Post_TransactionType_Valido()
        {
            Guid guid = new Guid("5E210F4F-D12B-4F85-8464-6F8740920FAA");

            TransactionType transactionType = new TransactionType
            {
                Id   = guid,
                Name = "TESTES..."
            };

            var service = new TransactionTypeService(_httpClient);
            var result  = await service.PostTransactionType(requestUri, transactionType);

            if (result.Status == HttpStatusCode.OK)
            {
                Assert.True(result.Status == HttpStatusCode.OK, "OK");
            }
            else
            {
                List <string> listError = new List <string>();
                foreach (string error in result.Data)
                {
                    listError.Add(error);
                }
                Assert.Collection(listError,
                                  item => Assert.Equal("The Name is Required", item),
                                  item => Assert.Equal("The Name must have between 2 and 30 characters", item),
                                  item => Assert.Equal("The Guid is empty", item),
                                  item => Assert.Equal("The Guid is invalid and contains 00000000", item),
                                  item => Assert.Equal("The transaction type id has already been taken.", item),
                                  item => Assert.Equal("The transaction type name has already been taken.", item)
                                  );
            }
        }
コード例 #2
0
        public async Task Post_TransactionType_The_Guid_is_empty()
        {
            TransactionType transactionType = new TransactionType
            {
                Id   = Guid.Empty,
                Name = "1"
            };

            var service = new TransactionTypeService(_httpClient);
            var result  = await service.PostTransactionType(requestUri, transactionType);

            if (result.Status == HttpStatusCode.OK)
            {
                Assert.True(result.Status == HttpStatusCode.OK, "OK");
            }
            else
            {
                List <string> listError = new List <string>();
                foreach (string error in result.Data)
                {
                    listError.Add(error);
                }
                Assert.Collection(listError,
                                  item => Assert.Equal("The Name is Required", item),
                                  item => Assert.Equal("The Name must have between 2 and 30 characters", item),
                                  item => Assert.Equal("The Guid is empty", item),
                                  item => Assert.Equal("The Guid is invalid and contains 00000000", item),
                                  item => Assert.Equal("The transaction type id has already been taken.", item),
                                  item => Assert.Equal("The transaction type name has already been taken.", item)
                                  );
            }
        }
コード例 #3
0
        public async Task Post_TransactionType_Seed()
        {
            List <TransactionType> listTransactionType = new List <TransactionType>();

            listTransactionType.Add(new TransactionType
            {
                Id   = Guid.NewGuid(),
                Name = "Crédito"
            });

            listTransactionType.Add(new TransactionType
            {
                Id   = Guid.NewGuid(),
                Name = "Débito"
            });

            foreach (TransactionType cardType in listTransactionType)
            {
                var service = new TransactionTypeService(_httpClient);
                var result  = await service.PostTransactionType(requestUri, cardType);

                if (result.Status == HttpStatusCode.OK)
                {
                    Assert.True(result.Status == HttpStatusCode.OK, "OK");
                }
                else
                {
                    List <string> listError = new List <string>();
                    foreach (string error in result.Data)
                    {
                        listError.Add(error);
                    }
                    Assert.Collection(listError,
                                      item => Assert.Equal("The Name is Required", item),
                                      item => Assert.Equal("The Name must have between 2 and 30 characters", item),
                                      item => Assert.Equal("The Guid is empty", item),
                                      item => Assert.Equal("The Guid is invalid and contains 00000000", item),
                                      item => Assert.Equal("The card type id has already been taken.", item),
                                      item => Assert.Equal("The card type name has already been taken.", item)
                                      );
                }
            }
        }