public async Task StatusCode_InputStatusCodeAndObject_ReturnsTextContentResultWithString() { await RunDependencyInjectedTestAsync ( async (serviceProvider) => { //Setup var statuscode = 200; var expectedContent = "{\"Name\":\"SampleName\",\"Age\":1}"; var sampleDataClass = new SampleDataClass { Age = 1, Name = "SampleName" }; //--UUT var uut = serviceProvider.GetRequiredService <IFunctionHelperService>(); var uutConcrete = (FunctionHelperService)uut; //Act var observed = uutConcrete.StatusCode(statuscode, sampleDataClass); //Assert Assert.IsNotNull(observed); Assert.AreEqual(expectedContent, observed.Content); Assert.AreEqual("application/json", observed.ContentType); Assert.AreEqual(statuscode, observed.StatusCode); await Task.CompletedTask.ConfigureAwait(false); }, serviceCollection => ConfigureServices(serviceCollection) ).ConfigureAwait(false); }
public void IfNull_Should_create_new_instance_of_the_object() { var @class = new SampleDataClass(); @class.IfNull(p => new SampleDataClass()); @class.Should().NotBeNull(); }