コード例 #1
0
        public void GetForm_WithNotExistingId_ShouldReturnNull()
        {
            // Arrange
            StarStuffDbContext db = this.Database;
            TelescopeService   telescopeService = new TelescopeService(db);
            const int          telescopeId      = 1;

            // Act
            TelescopeFormServiceModel result = telescopeService.GetForm(telescopeId);

            // Assert
            Assert.Null(result);
        }
コード例 #2
0
        public void GetForm_WithExistingId_ShouldReturnTelescope()
        {
            // Arrange
            StarStuffDbContext db = this.Database;
            TelescopeService   telescopeService = new TelescopeService(db);

            this.SeedDatabase(db);

            const int telescopeId = 1;

            Telescope expected = this.GetFakeTelescopes().FirstOrDefault(t => t.Id == telescopeId);

            // Act
            TelescopeFormServiceModel actual = telescopeService.GetForm(telescopeId);

            // Assert
            this.CompareTelescopes(expected, actual);
        }