Ejemplo n.º 1
0
        public async Task Compare_Should_Return_500_No_Record_Found()
        {
            CompareRequestModel requestModel = new CompareRequestModel();

            requestModel.Type = ComparisonEnum.Left;

            HttpResponseMessage response = await httpClient.PostAsync($"{host}/2", new StringContent(JsonConvert.SerializeObject(requestModel), Encoding.UTF8, "application/json"));

            response.StatusCode.Should().Be(HttpStatusCode.InternalServerError);

            ResponseBase servicResponse = await response.ToResponseBaseAsync();

            servicResponse.Success.Should().BeFalse();

            servicResponse.Message.Should().Be("No record found!");
        }
Ejemplo n.º 2
0
        public async Task Comparison_Should_Return_Equal_True(byte[] valueLeft, byte[] valueRight, ComparisonEnum type, int id)
        {
            await Should_Save_Left(id, valueLeft);

            await Should_Save_Right(id, valueRight);

            CompareRequestModel requestModel = new CompareRequestModel();

            requestModel.Type = type;

            HttpResponseMessage response = await httpClient.PostAsync($"{host}/{id}", new StringContent(JsonConvert.SerializeObject(requestModel), Encoding.UTF8, "application/json"));

            response.StatusCode.Should().Be(HttpStatusCode.OK);

            ResponseBase servicResponse = await response.ToResponseBaseAsync();

            servicResponse.Success.Should().BeTrue();

            ComparisonResponseObject resultObject = JsonConvert.DeserializeObject <ComparisonResponseObject>(servicResponse.Result.ToString());

            resultObject.Equal.Should().BeFalse();
            resultObject.SameSize.Should().BeTrue();
        }
Ejemplo n.º 3
0
        public async Task Comparison_Should_Throw_Exception_Due_To_Null_Right_Or_Left_Value(ComparisonEnum value, int id)
        {
            if (value == ComparisonEnum.Left)
            {
                await Should_Save_Left(id, new byte[4] {
                    1, 2, 3, 4
                });
            }
            else
            {
                await Should_Save_Right(id, new byte[4] {
                    1, 2, 3, 4
                });
            }

            CompareRequestModel requestModel = new CompareRequestModel();

            requestModel.Type = ComparisonEnum.Left;

            HttpResponseMessage response = await httpClient.PostAsync($"{host}/{id}", new StringContent(JsonConvert.SerializeObject(requestModel), Encoding.UTF8, "application/json"));

            response.StatusCode.Should().Be(HttpStatusCode.InternalServerError);

            ResponseBase servicResponse = await response.ToResponseBaseAsync();

            servicResponse.Success.Should().BeFalse();

            if (value == ComparisonEnum.Left)
            {
                servicResponse.Message.Should().Be("Right array is null!");
            }
            else
            {
                servicResponse.Message.Should().Be("Left array is null!");
            }
        }