Skip to content

Instantly share code, notes, and snippets.

View ifew's full-sized avatar
😙
wu hooo!

Chitpong Wuttanan (iFew) ifew

😙
wu hooo!
View GitHub Profile
@ifew
ifew / ExchangeRateServiceTest.cs
Created April 10, 2018 07:45
Unit Test and using Stub
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using api.Services;
using Moq;
using Moq.Protected;
using Xunit;
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using api.Services;
using Moq;
using Moq.Protected;
using Xunit;
@ifew
ifew / DAILY_AVG_EXG_RATE_V1.json
Created April 10, 2018 07:58
BOT API Respond - DAILY_AVG_EXG_RATE_V1
{
"result": {
"success": "true",
"api": "Daily Weighted-average Interbank Exchange Rate - THB / USD",
"timestamp": "2018-04-10 14:57:37",
"data": {
"data_header": {
"report_name_eng": "Rates of Exchange of Commercial Banks in Bangkok Metropolis (2002-present)",
"report_name_th": "อัตราแลกเปลี่ยนเฉลี่ยของธนาคารพาณิชย์ในกรุงเทพมหานคร (2545-ปัจจุบัน)",
"report_uoq_name_eng": "(Unit : Baht / 1 Unit of Foreign Currency)",
@ifew
ifew / BotService.cs
Created April 10, 2018 08:27
Call API BOT
using System;
using System.Net.Http;
using System.Threading.Tasks;
using api.Models;
using Newtonsoft.Json;
namespace api.Services
{
public class BotService
{
@ifew
ifew / BotServiceTest.cs
Created April 10, 2018 08:30
Integration Test for test Call API BOT
using System;
using Xunit;
using api.Services;
using System.Net.Http;
namespace api.IntegrationTest
{
public class BotServiceTest
{
[Fact]
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using api.Services;
using Moq;
using Moq.Protected;
using Xunit;
@ifew
ifew / IAuthorizeDummy.cs
Created July 5, 2018 08:21
.Net Core 2 Dummy
using System;
namespace member_dummy
{
public interface IAuthorize
{
Boolean CheckAuthorize(string username, string password);
}
public class Authorize : IAuthorize {
@ifew
ifew / Member.cs
Created July 5, 2018 08:32
.Net Core 2 Test Doubles
using System;
namespace member_dummy
{
public class Member
{
Boolean authorized;
public Member(IAuthorize authorize) {
this.authorized = authorize.CheckAuthorize("ifew", "1234");
@ifew
ifew / IAuthorizeStubTest.cs
Created July 5, 2018 09:13
.Net Core 2 Stub Test
using System;
using Xunit;
namespace member_stub
{
public class MemberTest
{
[Fact]
public void When_Member_Access_to_Profile() {
Member member = new Member(new StubAuthorize());
@ifew
ifew / IAuthorizeStub.cs
Created July 5, 2018 09:17
.Net Core 2 Stub
public class StubAuthorize : IAuthorize {
public Boolean CheckAuthorize(string username, string password) {
return true;
}
}
}