2 热度

.net测试篇之测试神器Autofixture Generator使用与自定义builder

有了上一节自定义配置,很多问题都能解决了,但是如果仅仅是为了解决一个简单问题那么创建一个类显得有点繁重.其实AutoFixture在创建Fixture对象时有很多方便的Fluent配置,我们这里介绍一些比较常用了.创建对象是忽略一些属性有些时候有这样的一些业务场景,有些字段是非必填项,但是一旦填写则必须符合指定规则.这些非必填字段在业务中仅仅当它存在的时候做一些校验,其它地方并没有使用到它.这样在单元测试的时候我们为了效率可以暂时忽略这些字段.在后面集成测试的时候再提供完整数据.下面看看AutoFixture在生成对象的时候如何显式地忽略一些字段之所以要忽略是因为如果不忽略AutoFixtur...

收录时间: 2019-08-23
分类: .NET
贡献者: Rector
10 热度

Uri.AbsoluteUri and UrlEncoding of Local File Urls

I have a love/hate relationship with the System.Uri class. It's great when it works as you expect, but I've had a few of battles related to Url encoding and decoding and in this post I'll point out one oddity that bit me today

收录时间: 2019-08-22
分类: .NET
贡献者: Rector
16 热度

.net测试篇之单元测试/集成测试神器Autofixture

有了单元测试框架加上Moq(后面我们会用单独章节来介绍moq),可以说测试问题基上都能搞定了.然而有了AutoFixture对单元测试来说可以说是如虎添翼,AutoFixture并且它能与moq,rhinomock等框架结合,对单元测试带来的便捷性,可维护性和扩展性更是难以言表,只有用用了才知道.

收录时间: 2019-08-21
分类: .NET
贡献者: Rector
14 热度

An Introduction to System.Threading.Channels

I’ve recently begun making use of a relatively new (well, it’s a little over a year old at the time of writing) feature called “Channels”. The current version number is 4.5.0 (with a 4.6.0 preview also available as pre-release) which makes it sound like it’s been around for a lot longer, but in fact, 4.5.0 was the first stable release of this package! In this post, I want to provide a short introduction to this feature, which I will hopefully build upon in later posts with some real-world scenarios explaining how and where I have successfully applied it.

收录时间: 2019-08-21
分类: .NET
贡献者: Rector
15 热度

AutoMapper LINQ Support Deep Dive

My favorite feature of AutoMapper is its LINQ support. If you're using AutoMapper, and not using its queryable extensions, you're missing out!Normal AutoMapper usage is something like...

收录时间: 2019-08-19
分类: .NET
贡献者: Rector
33 热度

.NET Framework 4.8 is available on Windows Update, WSUS and MU Catalog

We are happy to announce that Microsoft .NET Framework 4.8 is now available on Windows Update, Windows Server Update Services (WSUS) and Microsoft Update (MU) Catalog. This release includes quality and reliability fixes based on feedback since the .NET Framework 4.8 initial release.

收录时间: 2019-08-14
分类: .NET
贡献者: Rector
AD 友情赞助
82 热度

.Net异步编程详解入门

前言今天周五,早上起床晚了。赶着挤公交上班。但是目前眼前有这么几件事情。刷牙洗脸、泡牛奶、煎蛋。在同步编程眼中。先刷牙洗脸,然后烧水泡牛奶。再煎蛋,最后喝牛奶吃蛋。毫无疑问,在时间紧促的当下。它完了,稳的迟到、半天工资没了。那么异步编程眼中,或许还有一丝解救的希望。

收录时间: 2019-08-10
分类: .NET
贡献者: Rector
30 热度

Minimize new in Automated Tests

Automated tests have gained a lot of acceptance in recent years. Not long ago, many organizations bristled at the notion of having their expensive developers spend time writing code that wasn’t actually going to ship to production, but instead would just verify that the “real” code worked. Today...

收录时间: 2019-08-08
分类: .NET
贡献者: Rector
36 热度

How YOU can create a Serverless API in C# and .NET

In this article we will go through building a Serverless function using C# and .NET. We will explain the WHY of Serverless but also learn to build, run and debug our first functions in VS Code.

收录时间: 2019-08-08
分类: .NET
贡献者: Rector
42 热度

携程 Apollo 配置中心传统 .NET 项目集成实践

官方文档存在的问题可能由于 Apollo 配置中心的客户端源码一直处于更新中,导致其相关文档有些跟不上节奏,部分文档写的不规范,很容易给做对接的新手朋友造成误导。比如,我在参考如下两个文档使用传统 .NET 客户端做接入的时候就发现了些问题。ctripcorp/apollo - .Net客户端使用指南ctripcorp/apollo.net - .Net客户端之与 System.Configuration.ConfigurationManager 集成1.两个文档关于标识应用身份的AppId的配置节点不一致。2.第二个文档关于应用配置发布环境的Environment配置节点的描述出现明显错误。...

收录时间: 2019-08-07
分类: .NET
贡献者: Rector
28 热度

A Look at JsonDocument and System.Text.Json

Today I was writing a tool that needed to handle JSON, the content was relatively large and I only needed to pick out a few parts of the structure, and thought to myself this would be the perfect time to try out the new System.Text.Json JsonDocument.

收录时间: 2019-08-06
分类: .NET
贡献者: Rector
58 热度

.net持续集成单元测试篇之单元测试简介以及在visual studio中配置Nunit使用环境

什么是单元测试?单元测试是一段自动化的代码,这段代码调用被测试的工作单元,之后对这个单元的单个最终结果的某些假设进行检验。单元测试几乎都是用单元测试框架编写的。单元测试容易编写,能快速运行。单元测试可靠、可读、并且可维护。只要产品代码不发生变化,单元测试的结果是稳定的。

收录时间: 2019-08-01
分类: .NET
贡献者: Rector
59 热度

【译】WebAPI,Autofac,以及生命周期作用域

这是一篇关于AutoFac的生命周期作用域的文章。关于生命周期域一直以来都是一个令人头疼的命题,其中有些概念极易造成误解和混淆,比如域内单例(PerLifetimeScope)和请求内单例(InstancePerRequest)有什么区别、以及它们可不可以替换使用等等......这些问题之前也一直困扰着我,直到我在stackoverflow上发现了这篇文章的链接,作者利用示例代码 + 图文并茂的方式,彻底地解答了我的所有疑惑,感谢之余我就顺手把它翻译了下来。

收录时间: 2019-07-25
分类: .NET
贡献者: Rector
48 热度

4+1 Architectural View Model

It’s incredibly difficult to describe a complex system, regardless if you are developing a monolith or (micro) services. Use cases, code organization/navigation, interactions between services, and deployment/infrastructure are just some of the aspects that comprise the architecture of an entire system...

收录时间: 2019-07-25
分类: .NET
贡献者: Rector
80 热度

【半小时大话.net依赖注入】(下)详解AutoFac+实战Mvc、Api以及.NET Core的依赖注入

本来计划是五篇文章的,但是第一篇发了之后,我发现.NET环境下很多人对IoC和DI都很排斥,搞得评论区异常热闹。同一个东西,在Java下和在.NET下能有这么大的差异,也是挺有意思的一件事情。源码是一个虚构的项目框架,类似于样例性质的代码或者测试程序,里面很多注释,对理解DI,或怎么在MVC、WebApi和Core Api分别实现依赖注入有很好的帮助效果。

收录时间: 2019-07-18
分类: .NET
贡献者: Rector
AD 友情赞助
47 热度

CLR与JVM

首先要纠正垃圾回收在于JVM和.NET的CLR的平台功能而不是语言本身。存在一些历史差异主要是因为.Net的设计是从java(和其他基于gc的平台)演变中吸取教训改良后的结果。CLR一开始就设计成了分代垃圾回收,但是初始JVM没有分代垃圾收集器。第一代的JVM垃圾收集器往往是Mark和Sweep这样简单。但随着发展,JVM已引用了分代垃圾回收机制JVM提供了大量选项来调整GC各个方面或者在不同模式直接 的切换,例如相比之下,CLR几乎没有提供这样繁琐个性化配置,CLR通过不断优化.NET或者.NETCore的性能来达到通用高性能和依靠服务器端的性能收集器来进行优化,最新基准测试.NETCore...

收录时间: 2019-07-18
分类: .NET
贡献者: Rector
49 热度

Passing a binary file to a web service from a .NET app

Sometimes a web service requires us to pass a binary file, such as an image in the request body. To do this, we need to submit the request with the POST verb, because other verbs - most notably "GET" - do not contain a body. One simple web service that accepts a binary file is the Cognitive Serv...

收录时间: 2019-07-17
分类: .NET
贡献者: Rector
66 热度

Write Better Code Faster with Roslyn Analyzers

oslyn, the .NET compiler platform, helps you catch bugs even before you run your code. One example is Roslyn’s spellcheck analyzer that is built into Visual Studio. Let’s say you are creating a static method and misspelled the word static as statc. You will be able to see this spelling error before you run your code because Roslyn can produce warnings in your code as you type even before you’ve finished the line. In other words, you don’t have to build your code to find out that you made a mistake.

收录时间: 2019-07-11
分类: .NET
贡献者: Rector
69 热度

.NET Framework July 2019 Security and Quality Rollup

Today, we are releasing the July 2019 Cumulative Update, Security and Quality Rollup, and Security Only Update for .NET Framework....

收录时间: 2019-07-10
分类: .NET
贡献者: Rector
92 热度

【半小时大话.net依赖注入】(一)理论基础+实战控制台程序实现AutoFac注入

该系列共5篇文章,旨在以实战模式,在.net下的控制台程序Framework Mvc程序Framework WebApi程序Core Api程序分别实现依赖注入。其中.Net Framework框架主要以如何引入AutoFac作为容器以及如何运用AuotoFac为主,.Net Core框架除了研究引入AutoFac的两种方式,同时也运用反射技巧对其自带的DI框架进行了初步封装,实现了相同的依赖注入效果。...

收录时间: 2019-07-08
分类: .NET
贡献者: Rector
AD 友情赞助