public void ConfigureClient_MustWorkAsExpected() { var stream = new MemoryStream() as Stream; var password = new PasswordParameters { Password = "******" }; var parseResult = new ParseResult { Format = FormatType.Binary, RawData = new Dictionary <string, object>(), Status = LoadStatus.Success }; var serializeResult = new SerializeResult { Data = new MemoryStream(), Status = SaveStatus.Success }; RegisterModules(); fileLoader.Setup(n => n.TryLoad(It.IsAny <Uri>(), out stream)).Returns(LoadStatus.Success); binaryParser.Setup(b => b.CanParse(It.IsAny <Stream>())).Returns(true); binaryParser.Setup(b => b.TryParse(It.IsAny <Stream>(), It.IsAny <PasswordParameters>())).Returns(parseResult); binarySerializer.Setup(b => b.CanSerialize(FormatType.Binary)).Returns(true); binarySerializer.Setup(b => b.TrySerialize(It.IsAny <Dictionary <string, object> >(), It.IsAny <PasswordParameters>())).Returns(serializeResult); fileSaver.Setup(f => f.TrySave(It.IsAny <Uri>(), It.IsAny <Stream>())).Returns(SaveStatus.Success); var status = sut.ConfigureClientWith(new Uri("C:\\TEMP\\Some\\file.seb"), password); fileLoader.Verify(n => n.TryLoad(It.IsAny <Uri>(), out stream), Times.Once); binaryParser.Verify(b => b.TryParse(It.IsAny <Stream>(), It.IsAny <PasswordParameters>()), Times.Once); certificateStore.Verify(c => c.ExtractAndImportIdentities(It.IsAny <Dictionary <string, object> >()), Times.Once); binarySerializer.Verify(b => b.TrySerialize( It.IsAny <Dictionary <string, object> >(), It.Is <PasswordParameters>(p => p.IsHash == true && p.Password == string.Empty)), Times.Once); fileSaver.Verify(f => f.TrySave(It.IsAny <Uri>(), It.IsAny <Stream>()), Times.Once); Assert.AreEqual(SaveStatus.Success, status); }