Skip to content

ターゲット型と expected 型のダック一致を必須とする #19

Closed
@in-async

Description

@in-async

従来は actual も expected もダックタイプ的にターゲット型を実装していれば OK としてきたが、やはり actual と expected が一致していないのに一致しているとして成功するのは違和感がある。

var actual = new {
  Foo = 1,
  Bar = 2,
};

actual.AssertIs(new { Foo = 1 } );  // expected がターゲット型を満たしていないので失敗
actual.AssertIs(new { Foo = 1, Bar = 2 });  // 成功
actual.AssertIs(new { Foo = 1, Bar = 2, Baz = 3 });  // 現行ではこれも成功

ターゲット型と expected の型が完全に一致しない場合は失敗とした方が良さそう。

var actual = new {
  Foo = 1,
  Bar = 2,
};

actual.AssertIs(new { Foo = 1 } );  // expected がターゲット型を満たしていないので失敗
actual.AssertIs(new { Foo = 1, Bar = 2 });  // 成功
actual.AssertIs(new { Foo = 1, Bar = 2, Baz = 3 });  // 失敗にする

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions