public async Task return_valid_json_for_valid_requests() { var expectedResult = new Dictionary <string, Room>() { { "results", new Room() { Id = 5003, Description = "Ground Floor" } } }; DefaultContractResolver contractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }; var expectedStringResult = JsonConvert.SerializeObject(expectedResult, new JsonSerializerSettings { ContractResolver = contractResolver }); var randomId = Fake.GenerateRandomId(6); var result = await _client.GetStringAsync(_baseUri + randomId); Assert.Equal(expectedStringResult, result); }
public async Task return_500_when_internal_server_error_in_report_request() { var randomBadId = Fake.GenerateRandomId(4); var result = await client.GetAsync(baseUri + "drawing/" + triggerExceptionId); Assert.Equal(HttpStatusCode.InternalServerError, result.StatusCode); }
public async Task return_200_for_valid_photoByPropertyId_request() { var randomId = Fake.GenerateRandomId(8); var result = await client.GetAsync(baseUri + "photo?propertyid=" + randomId); Assert.Equal(HttpStatusCode.OK, result.StatusCode); }
public async Task return_200_for_valid_request() { var randomId = Fake.GenerateRandomId(6); var result = await _client.GetAsync(_baseUri + randomId); Assert.Equal(HttpStatusCode.OK, result.StatusCode); }
public async Task return_valid_json_for_valid_requests() { var expectedResultContent = new Inspection() { Id = 655, LocationDescription = "A house" }; var expectedResult = new Dictionary <string, IEnumerable <Inspection> >() { { "results", new List <Inspection>() { { expectedResultContent } } } }; DefaultContractResolver contractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }; var expectedStringResult = JsonConvert.SerializeObject(expectedResult, new JsonSerializerSettings { ContractResolver = contractResolver }); var randomId = Fake.GenerateRandomId(6); var result = await client.GetStringAsync(baseUri + randomId); Assert.Equal(expectedStringResult, result); }
public AsbestosServicesTests() { fakeLogger = new Mock <ILoggerAdapter <AsbestosService> >(); fakePsiLogger = new Mock <ILoggerAdapter <Psi2000Api> >(); fakeId = Fake.GenerateRandomId(6); fakeDescription = Fake.GenerateRandomText(); }
public RoomControllerTests() { fakeActionsLogger = new Mock <ILoggerAdapter <AsbestosActions> >(); fakeControllerLogger = new Mock <ILoggerAdapter <DataController> >(); fakeAsbestosService = new Mock <IAsbestosService>(); fakeId = Fake.GenerateRandomId(6); fakeDescription = Fake.GenerateRandomText(); }
public async Task return_valid_json_for_valid_photoByPropertyId_requests() { var randomId = Fake.GenerateRandomId(8); var result = await client.GetStringAsync(baseUri + "photo?propertyid=" + randomId); var expectedStringResult = GetexpectedStringResult(); Assert.Equal(expectedStringResult, result); }
public async Task return_file_for_valid_main_photo_request() { var randomId = Fake.GenerateRandomId(6); var result = await client.GetAsync(baseUri + "mainphoto/" + randomId); var fileResult = result.Content.ReadAsByteArrayAsync().Result; Assert.Equal(HttpStatusCode.OK, result.StatusCode); Assert.Equal(54, fileResult.Length); }
public DocumentFileControllerTests() { fakeActionsLogger = new Mock <ILoggerAdapter <AsbestosActions> >(); fakeControllerLogger = new Mock <ILoggerAdapter <DocumentController> >(); fakeAsbestosService = new Mock <IAsbestosService>(); fakeId = Fake.GenerateRandomId(5); random = new Random(); randomPick = random.Next(3); }
public AsbestosActionsTests() { fakeLogger = new Mock <ILoggerAdapter <AsbestosActions> >(); fakeAsbestosService = new Mock <IAsbestosService>(); fakeId = Fake.GenerateRandomId(6).ToString(); }