Skip to content

Commit 4240025

Browse files
committed
Update the test code
1 parent e3fd198 commit 4240025

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

test/Unit/Utility/TypeExtensionsTests.cs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,8 @@ namespace Microsoft.Azure.Functions.PowerShellWorker.Test
2020
{
2121
public class TypeExtensionsTests
2222
{
23-
private readonly ConsoleLogger _testLogger;
24-
private readonly PowerShellManager _testManager;
25-
26-
public TypeExtensionsTests()
27-
{
28-
_testLogger = new ConsoleLogger();
29-
_testManager = TestUtils.NewTestPowerShellManager(_testLogger);
30-
}
31-
3223
#region TypedDataToObject
24+
3325
[Fact]
3426
public void TestTypedDataToObjectHttpRequestContextBasic()
3527
{
@@ -343,7 +335,7 @@ public void TestObjectToTypedDataRpcHttpBasic()
343335
}
344336
};
345337

346-
Assert.Equal(expected, input.ToTypedData(null));
338+
Assert.Equal(expected, input.ToTypedData());
347339
}
348340

349341
[Fact]
@@ -366,7 +358,7 @@ public void TestObjectToTypedDataRpcHttpContentTypeSet()
366358
}
367359
};
368360

369-
Assert.Equal(expected, input.ToTypedData(null));
361+
Assert.Equal(expected, input.ToTypedData());
370362
}
371363

372364
[Fact]
@@ -389,7 +381,7 @@ public void TestObjectToTypedDataRpcHttpContentTypeInHeader()
389381
}
390382
};
391383

392-
Assert.Equal(expected, input.ToTypedData(null));
384+
Assert.Equal(expected, input.ToTypedData());
393385
}
394386

395387
[Fact]
@@ -412,7 +404,7 @@ public void TestObjectToTypedDataRpcHttpStatusCodeString()
412404
}
413405
};
414406

415-
Assert.Equal(expected, input.ToTypedData(null));
407+
Assert.Equal(expected, input.ToTypedData());
416408
}
417409

418410
[Fact]
@@ -426,7 +418,7 @@ public void TestObjectToTypedDataInt()
426418
Int = data
427419
};
428420

429-
Assert.Equal(expected, input.ToTypedData(null));
421+
Assert.Equal(expected, input.ToTypedData());
430422
}
431423

432424
[Fact]
@@ -440,7 +432,7 @@ public void TestObjectToTypedDataDouble()
440432
Double = data
441433
};
442434

443-
Assert.Equal(expected, input.ToTypedData(null));
435+
Assert.Equal(expected, input.ToTypedData());
444436
}
445437

446438
[Fact]
@@ -454,7 +446,7 @@ public void TestObjectToTypedDataString()
454446
String = data
455447
};
456448

457-
Assert.Equal(expected, input.ToTypedData(null));
449+
Assert.Equal(expected, input.ToTypedData());
458450
}
459451

460452
[Fact]
@@ -468,7 +460,7 @@ public void TestObjectToTypedDataBytes()
468460
Bytes = ByteString.CopyFrom(data)
469461
};
470462

471-
Assert.Equal(expected, input.ToTypedData(null));
463+
Assert.Equal(expected, input.ToTypedData());
472464
}
473465

474466
[Fact]
@@ -483,7 +475,7 @@ public void TestObjectToTypedDataStream()
483475
Stream = ByteString.FromStream(data)
484476
};
485477

486-
Assert.Equal(expected, input.ToTypedData(null));
478+
Assert.Equal(expected, input.ToTypedData());
487479
}
488480
}
489481

@@ -498,7 +490,7 @@ public void TestObjectToTypedDataJsonString()
498490
Json = data
499491
};
500492

501-
Assert.Equal(expected, input.ToTypedData(null));
493+
Assert.Equal(expected, input.ToTypedData());
502494
}
503495

504496
[Fact]
@@ -512,7 +504,7 @@ public void TestObjectToTypedDataJsonHashtable()
512504
Json = "{\"foo\":\"bar\"}"
513505
};
514506

515-
Assert.Equal(expected, input.ToTypedData(_testManager));
507+
Assert.Equal(expected, input.ToTypedData());
516508
}
517509

518510
[Fact]
@@ -526,7 +518,7 @@ public void TestObjectToTypedData_PSObjectToJson_1()
526518
Json = "{\"foo\":\"bar\"}"
527519
};
528520

529-
Assert.Equal(expected, input.ToTypedData(_testManager));
521+
Assert.Equal(expected, input.ToTypedData());
530522
}
531523

532524
[Fact]
@@ -541,7 +533,7 @@ public void TestObjectToTypedData_PSObjectToJson_2()
541533
Json = "{\"foo\":\"bar\"}"
542534
};
543535

544-
Assert.Equal(expected, input.ToTypedData(_testManager));
536+
Assert.Equal(expected, input.ToTypedData());
545537
}
546538
}
547539

@@ -551,7 +543,7 @@ public void TestObjectToTypedData_PSObjectToBytes()
551543
var data = new byte[] { 12,23,34 };
552544
object input = PSObject.AsPSObject(data);
553545

554-
TypedData output = input.ToTypedData(_testManager);
546+
TypedData output = input.ToTypedData();
555547

556548
Assert.Equal(TypedData.DataOneofCase.Bytes, output.DataCase);
557549
Assert.Equal(3, output.Bytes.Length);
@@ -563,7 +555,7 @@ public void TestObjectToTypedData_PSObjectToStream()
563555
using (var data = new MemoryStream(new byte[] { 12,23,34 }))
564556
{
565557
object input = PSObject.AsPSObject(data);
566-
TypedData output = input.ToTypedData(_testManager);
558+
TypedData output = input.ToTypedData();
567559

568560
Assert.Equal(TypedData.DataOneofCase.Stream, output.DataCase);
569561
Assert.Equal(3, output.Stream.Length);
@@ -574,7 +566,7 @@ public void TestObjectToTypedData_PSObjectToStream()
574566
public void TestObjectToTypedData_PSObjectToString()
575567
{
576568
object input = PSObject.AsPSObject("Hello World");
577-
TypedData output = input.ToTypedData(_testManager);
569+
TypedData output = input.ToTypedData();
578570

579571
Assert.Equal(TypedData.DataOneofCase.String, output.DataCase);
580572
Assert.Equal("Hello World", output.String);

0 commit comments

Comments
 (0)